I have set a swarm cluster 3 nodes on Virtualbox.
I deploy this docker-compose.yml file (an Hapijs application with Mongodb):
version: "3.7" services: biblioapi: image: geekbot/biblioapi:latest env_file: - api.env deploy: replicas: 3 restart_policy: condition: any ports: - "3000:3000" depends_on: - bibiomongo bibliomongo: image: geekbot/bibliomongo:latest deploy: restart_policy: condition: any replicas: 1 volumes: - type: volume source: conf.volume target: /data/configdb - type: volume source: data.volume target: /data/db volumes: conf.volume: data.volume:
Images are public on hub.docker.com, so you can test yourself.
I launch the deployment with this command:
docker stack deploy -c docker-compose.yml biblio
All containers are created, distributed on the nodes, they run properly but port 3000 is published externally on host nodes but connection is refused. netstat shows that 3000 is open on the host
tcp6 0 0 [::]:3000
On the internal network I can connect on the web server on 3000 and everything is ok.
Moreover, running independently containers (not in swarm mode) publishes correctly on the host and accept connection.
What do I do wrong ? I guess I missed something…
Last Docker version, last Compose version. Linux Ubuntu 16.04. VirtualBox 5.2.26
Thanks for you help.