Docker Community Forums

Share and learn in the Docker community.

Docker Swarm - Options and commands

(Efratushhh) #1


Hope guys you can help here :slight_smile:

I’ve setup a docker swarm manager. Additionally, I’ve got 3 hosts that set as docker nodes (workers).


  1. What are the equivalent Swarm commands of the following docker commands:
    docker build -t webservice_users .

docker run --name webservice_users -p 8000:8000 -v /app_services/myapps/users:/usr/src/app_users --link mongo:mongo -d webservice_users

sudo docker ps -a

docker run --name webservice_frontend -p 8003:8003 -v /app_services/myapps/app_frontend:/usr/src/app_frontend --link webservice_users:webservice_users -d webservice_frontend

docker run --net=container:webservice_users --privileged=true
-e DEVICE=eth0
-v $PWD/users_detector/suricata_conf_files:/etc/suricata
-d suricata_users_detector

  1. What is the Swarm command go achieve the hosts IPs and what containers are running on each?

  2. Is it possible to run a container on a specific host? Or the Swarm manager chooses it randomly?

  3. I’d like to write a python script that subscribes to modification with the containers/workers topology, so that everytime a container
    is stopped and then running on a different host, then an alert is being generated so I can see it.

Is it possible?

Thanks a lot!!