images
images copied to clipboard
404 Not found another container in docker-compose
Hi!
I have my own service that can give out pictures. For example, the address (server in docker-compose) http://localhost:81/media/image.png will return a valid and correct picture image.png But if the same address is used to get a thumbnail image, I get a 404. At the same time curl call inside weserv container successfully downloads my image
WESERV_PORT - 8086
PUBLIC_PORT - 85
version: '3'
services:
server:
build: ./unit
working_dir: /var/www/
restart: unless-stopped
ports:
- "${PUBLIC_PORT}:81"
volumes:
- ./unit/config.json:/docker-entrypoint.d/config.json
- ./../.:/var/www
- ${PUBLISH_FOLDER}:/media
redis:
image: redis:alpine
restart: unless-stopped
volumes:
- ./data/redis:/data
weserv:
image: maffinca69/weserv-arm64
restart: unless-stopped
ports:
- "${WESERV_PORT}:80"
shm_size: '1GB'
maffinca69/weserv-arm64 - image for my mac (arm) without changes
curl --output te2.jpg http://server:81/media/image.png
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16.9M 100 16.9M 0 0 320M 0 --:--:-- --:--:-- --:--:-- 326M
Could it be that the issue is due to IPv6? Is the result different if you pass the -6
flag to curl
? Otherwise I suspect some DNS issue, might be that the resolver in the nginx config does not know how to resolve server
.
I disabled ipv6 listening in all nginx config files, but that didn't help. I also disabled google and open-dns servers by commenting out resolver in the configuration files
I tried setting ipv6only=off, but that didn't help either
Even with seemingly disabled ipv6 curl with option -6
gives the following:
Could not resolve host: server
i can rename my server container if it's helped
UPD: response weserv:
{
"status": "error",
"code": 404,
"message": "The hostname of the origin is unresolvable (DNS) or blocked by policy."
}
So far I've solved the problem by just embedding the files I need directly into the container (everything works locally anyway) and using via /static
This is probably even better since everything works locally
I think you could make it work by setting the DNS resolver to Docker's embedded DNS server within the nginx configuration, see: https://github.com/weserv/images/issues/206#issuecomment-1752740666.
But indeed, using the weserv filter
mode (available on /static
) is probably a better solution for this.
I hope this information helped. Please feel free to re-open if questions remain.