loris-imageserver / loris-docker

Loris docker image suitable for development environments
16 stars 20 forks source link

Instructions for using your own image folder don’t work #9

Open alexwlchan opened 7 years ago

alexwlchan commented 7 years ago

The README contains some instructions for passing a directory of images into the Loris container:

Use your own image folder

Add your image directory as a volume

$ docker run -d -v <your-img-folder>:/usr/local/share/images -p 5004:5004 lorisimageserver/loris

But if I try this, it doesn’t work – I get errors when I try to look up an image:

Not Found: could not resolve identifier: cat.jpg (404)

Poking around inside the container, it seems like Loris is actually serving images from /opt/loris/tests/img instead – if I replace the command with

$ docker run -d -v ~/images:/opt/loris/tests/img -p 5004:5004 lorisimageserver/loris

then I see the behaviour I expect.

I’d offer a fix, but I’m not sure whether this should be a change to the README, or if it indicates a bug in the container.


Output of docker inspect lorisserver/loris
```json [ { "Id": "sha256:01cdfd3512bbc7812961efc1867b1f9e4ac169f68636845265df385ef40be72d", "RepoTags": [ "lorisimageserver/loris:latest" ], "RepoDigests": [ "lorisimageserver/loris@sha256:b9dfabf6578e312fd249c3d5081e099da107ec26e621254dbf22741e7d68c307" ], "Parent": "", "Comment": "", "Created": "2016-12-13T19:12:37.224188702Z", "Container": "d3e355bd74f2116ad8f6edba876dac1cd7d8977ba3548e4e0e9b1d2b1d612412", "ContainerConfig": { "Hostname": "6766fe1c072d", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "5004/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "HOME=/root" ], "Cmd": [ "/bin/sh", "-c", "#(nop) ", "CMD [\"python\" \"webapp.py\"]" ], "ArgsEscaped": true, "Image": "sha256:e7cb9b298bf48d42859f845f3785f24b9b77e59f04b5775a5680387ab83f415f", "Volumes": null, "WorkingDir": "/opt/loris/loris", "Entrypoint": null, "OnBuild": [], "Labels": {} }, "DockerVersion": "1.12.3", "Author": "eliotj@princeton.edu", "Config": { "Hostname": "6766fe1c072d", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "ExposedPorts": { "5004/tcp": {} }, "Tty": false, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "HOME=/root" ], "Cmd": [ "python", "webapp.py" ], "ArgsEscaped": true, "Image": "sha256:e7cb9b298bf48d42859f845f3785f24b9b77e59f04b5775a5680387ab83f415f", "Volumes": null, "WorkingDir": "/opt/loris/loris", "Entrypoint": null, "OnBuild": [], "Labels": {} }, "Architecture": "amd64", "Os": "linux", "Size": 621313493, "VirtualSize": 621313493, "GraphDriver": { "Name": "aufs", "Data": null }, "RootFS": { "Type": "layers", "Layers": [ "sha256:d29d52f94ad5aa750bd76d24effaf6aeec487d530e262597763e56065a06ee67", "sha256:dfcc17ddae9e5bab2da074f94856a2a1a42b21e402b49815bb4f87b048082ca5", "sha256:1c53295311c1505bddc4d07d5992434de18243951059ab5ea7b2daf9cec1488a", "sha256:18568efa7ad4beb199f7a9dc211b33fb2b165dcc0966c4c74af3f5ae396f3ec3", "sha256:0d45be5b95d86888d2f6beda0fddb089ba61a3ddc514fdb0a4fd022aad19a392", "sha256:08466fc4bfe055100973c7b28b1dca7b9cb51d6996167fd8a565cb51c90a366c", "sha256:1a3e3acce373c85d397ef63fc5bc2508219f6ea75b6b8fbaccb2beeeec77c138", "sha256:96f99d9a9695cd2675ff8c41266c95becd742c829c455a020bada4f202f5571e", "sha256:8b873f352b523fae31a9d5cd7a96103e9c525cb53783b0b072c8e6a52e0ff260", "sha256:45e761f570eb1c15a78857c28eaa1dcd3fdb843f833f347f9ebd7e5f7af081ab", "sha256:82b0caa9dc7c8fd63d98f94d7988fa3939f13e797ba36e374155b1e14b826bcb", "sha256:8e83d61a90b4f5159d5eb08604b5aa97b2d8264ba705045cc9083fe789bd8b8a", "sha256:64fcc4daa9ae954e61c072fd23177a71280e1c3602e7a6bfa75c8c725de649c3", "sha256:8586a17f85e9d9f4383323fca82e0e4021cdc6f54f389877c5d63886e213f95a", "sha256:25a32c980065c26a15c62c84988516efbf8a7dcc3801503acfb02850113fd490", "sha256:6a3666953edbc4a904113d87e5a006b28780dcf758743e6a079f0c1319d638c2", "sha256:5e61989e82a3a06be3284198a1c50baa8f015457d427903c0f7c92b5302230cd", "sha256:76b9a766b53c0983d548781e0edb1fab872b796b21b567bdab6a3584f1be9a91", "sha256:6d302c90fa138d42f38cb1df5ae1448375b6c480b88f01ce1a29a8da32b2630e", "sha256:33dc2315cc8b93f3b614753745610b4191c87b05f892c50346c0545725c90031", "sha256:5e12f694b606a88fa453df146822ef1caaf5191df5eebc1bf79bc3f56cf07f6f", "sha256:f0863b3072c26a0c1d3a276eea93aa49f068d3df4638b9c7f45695f106f800dc" ] } } ] ```
regisrob commented 7 years ago

I ran into the same issue and I can confirm this solution worked for me too! Thanks @alexwlchan

tvanbeek commented 4 years ago

Maybe I found the issue.

In loris2.conf under [resolver] we find the following:

[resolver]
...
src_img_root = '/usr/local/share/images' # r--

However, in webapp.py on line 58 we see this:

# override some stuff to look at relative or tmp directories.
...
config['resolver']['src_img_root'] = path.join(project_dp,'tests','img')

So it seems that for one reason or another (maybe debugging) the config path is overwritten with a hardcoded path to the folder tests/img.