Docker Run cannot take in more than one directories
hifocus opened this issue · comments
Describe the bug
I installed webp-server-go via docker and had it running. I have two domains, blog-images.huangxin.dev
and huangxin.dev
. Both using identical nginx config:
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~* \.(?:jpg|jpeg|gif|png|bmp)$ {
proxy_pass http://127.0.0.1:3333;
proxy_set_header X-Real-IP $remote_addr;
proxy_hide_header X-Powered-By;
proxy_set_header HOST $http_host;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
deny all;
}
location /.well-known {
allow all;
}
However, any images located in the huangxin.dev
cannot be accessed by webp-server. For an example:
https://huangxin.dev/assets/avatar/1420402599.jpg
This exact same image being copied to another directory (I copied it server-side), works via webp-server:
https://blog-images.huangxin.dev/1420402599.jpg
The log is as such:
$docker container logs 8fdfa91e5ac0
18:09:13 | 404 | 1ms | 172.17.0.1 | GET | /assets/avatar/1420402599.jpg
time="2023-06-11 18:09:13" level=warning msg="image not found" func="[79:main.convert()]"
18:19:08 | 404 | 0s | 172.17.0.1 | GET | /359550_20230506212823_1.png
time="2023-06-11 18:19:08" level=warning msg="image not found" func="[79:main.convert()]"
time="2023-06-11 18:19:26" level=warning msg="exhaust/1420402599.jpg.1686505045.avif not found on filesystem" func="[263:main.findSmallestFiles()]"
I have confirmed/tried that:
- both domains has identical nginx setup, and the 404 url is indeed passed onto webp-server (if I stop passing requests to webp-server, it will return the jpg image via nginx)
- restarting the system/container didn't help
- nginx has ownership to the directory, whlist I don't know how to give ownership to webp-server, if ownership is indeed the cause
- I just installed webp-server yesterday via docker, so it should be the lastest
Environment (please complete the following information):
- OS: Ubuntu 20.04.6 LTS
- version or branch: should be WebP Server Go 0.8.4
- nginx: nginx/1.23.4
- docker: 24.0.2, build cb74dfc
Additional context
ls -l /data/wwwroot/
gives the following:
root@jp-prod:~/oneinstack# ls -l /data/wwwroot/
total 36
drwxr-xr-x 3 www www 4096 Jun 11 22:51 default
drwxr-xr-x 18 www docker 4096 Jun 12 01:37 huangxin.dev
drwxr-xr-x 5 www www 4096 Jun 12 02:08 images1
I appreciate your help and please let me know if any other logs are neccessary.
I have revisited the issue and identified the cause:
Upon docker run, docker run -d -p 3333:3333 -v /path/to/pics:/opt/pics --name webp-server webpsh/webp-server-go
, whlist the documentation has made clear that The path /opt/pics is currently unable modify because it’s defined in the config.json while building the docker image.
, only one directory can be involved for webp-server to process.
Therefore, if I had two directories:
/data/wwwroot/huangxin.dev
/data/wwwroot/blog-images.huangxin.dev
I don't know how to supply both directories to webp-server.
I am currently trying a self-compilation, however it was not the most elegant solution. Is it possible to involve more than one directory?
Closing for now