Closed IlCallo closed 4 years ago
I used volumes instead of a mount and it worked fine for me. Maybe this would be something to try? I never worked with mounts.
Could be a good thing to try, even if docs say --mount
is the preferred way and I thought type=bind
was more fitting in this case, due to the transitory nature of the container
Thanks for the detailed report @IlCallo. I'm also using volumes usually rather than mount, but I'm not sure if it makes a difference to be honest.
One thing worth checking is FILE_LOADER_ROOT_PATH
which you should probably set explicitly?
Here's a simple docker-compose example that works for me mapping a local ./images
folder
version: '3'
services:
thumbor:
image: minimalcompact/thumbor
environment:
# VIRTUAL_HOST is picked up by nginx-proxy. Here it's set for localhost
# but you usually need to point it to your domain, e.g. thumbor.example.com
- VIRTUAL_HOST=localhost
# THUMBOR_NUM_PROCESSES control how many processes run inside the container
# Normally this is set in connection with the number of CPU cores
# Note however that you can also use the docker-compose scale option to dynamically
# scale your thumbor instances
- THUMBOR_NUM_PROCESSES=4
# this would allow CORS from any origin (you can restrict to specific origins if you want)
- CORS_ALLOW_ORIGIN=*
# returns a webp image if browser Accept headers match
- AUTO_WEBP=True
# nginx-proxy does caching automatically, so no need to store the result storage cache
# (this greatly speeds up and saves on CPU)
- RESULT_STORAGE=thumbor.result_storages.no_storage
- RESULT_STORAGE_STORES_UNSAFE=True
- LOADER=thumbor.loaders.file_loader
- FILE_LOADER_ROOT_PATH=/var/images
restart: always
networks:
- app
volumes:
- ./images:/var/images
ports:
- "8888:80"
networks:
app:
driver: bridge
If it still doesn't work, can you try to create a reproducible docker-compose.yml
file ?
@IlCallo see edited note above
I tried to make it work with volumes, but it seems like there are a couple problems.
Volumes are not what I'm searching for, as they are persisted and slower than bindings (as stated by the docs), and their management is much more complicated than bindings, for the lightweight and transitory usage we need.
Volumes shared between windows host and linux containers doesn't seem to work well together, at least when using Hyper-V mode. I updated Windows to get WSL2 and will try again next week.
I specified all env vars, as suggested, but to no avail.
Are you aware of any way to make thumbor log the path where it's searching for the images? Unluckily I never used python and reading the codebase isn't so easy for me.
Also, I'm a newbie in Docker world, so I'm not sure what is Docker compose, even if I get the grasp of it by the configuration you provided. Will read more about it and check if I can produce a configuration like you asked @gingerlime
Could be because I set the binding on /app/loader
? Will try to create it in a random root level folder to check if it's the default folder which is causing problems.
Hi @IlCallo if you'd like to submit a docker-compose.yml file that reproduces this, I'd be happy to take a look. Otherwise, the example I posted above works for me. I don't have any issues using volumes.
I'll close this for now, but please re-open if you have any further info :)
The current directory is correctly mounted into
/app/loader
(which is the defaultFILE_LOADER_ROOT_PATH
)
That's the mistake. Default is /data/loader
.
The right command then is docker run -p 8888:80 --name ril-thumbor --env-file .thumbor-env --mount type=bind,source="$(pwd)",target=/data/loader,readonly --rm minimalcompact/thumbor
.
The wonders that taking a long break can make...
I could not find a way to tell Thumbor tell me where he was picking up the file, so I
strace
ps aux
to get python process PIDstrace -p <PID>
to attach to the process and listen to its syscallopen
callsHope this can be useful for other newbies like me (or myself in some months) which will need to debug what Thumbor is actually doing.
Thanks for the details, @IlCallo and glad to hear you figured it out! 👍
Hello there! Thank you for creating and maintaining this docker image. I'm working on a webpack loader which uses thumbor to solve the Art Direction problem in websites development.
The loader works fine on linux environments with a local thumbor installation, but I'm trying to add Windows and Mac support and docker seems our best shot to unify the DX. Right now, we are testing the Windows integration.
Unluckily, it seems that using the file loader to work with images into a folder mounted via
--mount
option isn't working. Right now I'm manually testing the system before automatizing the process and all I can get are 404 errors.This is the command I use to launch the container
docker run -p 8888:80 --name ril-thumbor --env-file .thumbor-env --mount type=bind,source="$(pwd)",target=/app/loader,readonly --rm minimalcompact/thumbor
.thumbor-env
I use
docker exec -it ril-thumbor bash
to enter the container and check what's going on inside.What works
localhost:8888
/app/thumbor.conf
, seems correct, all options provided via env file are correctly overriden/app/loader
(which is the defaultFILE_LOADER_ROOT_PATH
) and I can access and read the content of the mounted folder when connected via bashWhat doesn't work
Any request result in a 404 error, which leads me to think something is wrong with the path (the root path, the one we provide, or both). We already successfully use thumbor in this way when it's installed locally, the only difference being
FILE_LOADER_ROOT_PATH
set to/home/
(absolute paths to images are provided except the initial/home/
part).What URLs I tried, by accessing them via Chrome browser:
http://localhost:8888/unsafe/500x150/smart/src/assets/images/my-image.jpg
: this should be the correct one, AFAIKhttp://localhost:8888/unsafe/500x150/smart/my-image.jpg
: we moved the image into/app/loader
to check if the problem was about the path slashes, still 404, seems that's not the problemhttp://localhost:8888/unsafe/500x150/smart/app/loader/src/assets/images/my-image.jpg
: random guesshttp://localhost:8888/unsafe/500x150/smart/loader/src/assets/images/my-image.jpg
: random guesshttp://localhost:8888/unsafe/500x150/src/assets/images/my-image.jpg
: random guesshttp://localhost:8888/unsafe/500x150//src/assets/images/my-image.jpg
: strange random guessThumbor isn't providing any useful info even with debug log level, especially I cannot find a way to make thumbor tell me where it's actually searching the image, so I'm just going on blindly.
Thumbor log with DEBUG level
Other possible causes:
Does this ring any bell to you? Have you run into something like this in the past?