Im getting strange behavior when restarting or updating my docker-compose stack. The first time I init a swarm and deploy a stack I am able to hit the NGINX proxy and be greeted with my application messages. Now if i tear down the service:
docker stack rm hello
I see there a no containers. But running the same command again:
docker stack deploy -c helloworld/docker-compose.yml hello
I can reach my application on port 8080 fine but the NGINX server just times out despite the replica set stating its deployed.
This is my docker compose file:
services: web: image: helloworld_web:latest deploy: replicas: 3 resources: limits: cpus: "0.1" memory: 50M restart_policy: condition: on-failure ports: - "8080:8080" networks: - webnet command: gunicorn -b :8080 app:application nginx: image: helloworld_nginx:latest deploy: replicas: 1 restart_policy: condition: on-failure ports: - "80:80" networks: - webnet depends_on: - web networks: webnet:
It seems the only way to get it working again is to leave the swarm and restart the docker service.
Is there a simple command im missing that will fix this issue? Its worth noting that the same compose file with docker-compose up works fine with restarts every time (with the warnings of deploy being ignored when not in a swarm)