Docker Community Forums

Share and learn in the Docker community.

Docker stack deploy not deploying to IP (how?)

Hello Devs,
Using this tutorial I successfully initialize Docker Swarm and deploy the stack from my Digital Ocean droplet:

user@droplet $ docker swarm init --advertise-addr 167.172.163.148
user@droplet $ docker stack deploy -c ~/etc/website_phx/docker-compose.yml website_phx

Thats ok, but I don’t see anything on my IP. To mention, on my local machine using the same docker-compose.yml and dockerfile everything works (via docker-compose up). Now, on my host we can see our container working:

$ sudo docker ps
CONTAINER ID        COMMAND                CREATED          STATUS          PORTS     
d24f87fe58d9  "bash /app/entrypoin…"   15 minutes ago   Up 15 minutes      4000/tcp   

Seeing ports -> 4000/tcp I tried 167.172.163.148:4000 too, but nothing again… Nginx server is stopped and not interfering, must be something with my Docker (Docker version 20.10.7, build f0df350).
What I am missing?

Best Regards

For a swarm service, published ports are attached to the service, not to the container. Try docker service ps ${service_name} instead.