Docker Community Forums

Share and learn in the Docker community.

Cannot connect to nginx containers at times

I am unable to access my nginx container on occasion, when it happens only a full reboot seems to work, and then only sometimes. I startup my containers, connect to localhost, and nothing… tried running docker ps, running as expected, then tried docker logs but there are no logs showing any attempt to connect. I cannot connect by the containers direct IP either. Best I can pin down is traffic is not getting routed from my system to the docker network, but this only affects this container, others like my phpmyadmin container I can access without any issues.

I know its not a port conflict because every port I try fails just the same yet every port I tried I also works if configured on another container (not at the same time obviously). I have tried purging data from docker desktop, factory resetting it. Nothing seems to work.

I haven’t change anything in my docker-compose or other config to cause it to stop working. I also tried docker-compose down then docker-compose up again. I even stopped and restarted docker desktop to no avail. I am at a loss to why this isn’t working.

The relevant portion of my docker-compose:

image: nginx:stable-alpine
container_name: web
- “80:80”
- ./src:/var/www/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./.env