Docker Community Forums

Share and learn in the Docker community.

Accessing ports in Docker Swarm

swarm

#1

Hello,

My question is: How can I access container ports from outside, while the containers are running on a Docker Swarm?

I went through the tutorials and managed to get a bunch of Docker containers up and running via a docker-compose file. Then I tried to run the file “docker-compose.yml” on a Docker swarm with three nodes:

docker stack deploy --compose-file docker-compose.yml dataservice

Containers are running fine, everything looks good: and in the Docker documentation (https://docs.docker.com/engine/swarm/ingress/#publish-a-port-for-a-service) I read that I should be able to access the containers now by accessing the ports which are defined ind the yml file. But this doesn’t work, there is no port exposed to the nodes.

Here is one of the containers definition in the yml file:

minio:
image: minio/minio
volumes:
- minio:/data
command: server /data
ports:
- “9000:9000”

I googled around and found some entries about a bug in Docker, is this what I’m running into? Or am I on a wrong way?

Thanks for any help!