0

I have a few micro-services deployed as a stack on docker swarm, with each micro-service running in a separate container.

How do I give commands to the swarm from within one of the services running inside a container on the swarm manager host? e.g running "docker service update" command from within a container to update one of the services in the swarm.

I read somewhere that it can be done by bind mounting the docker socket using:

-v /var/run/docker.sock:/var/run/docker.sock

But this does not work for me. I get docker not found error upon trying to run docker command from within the container.

  • Only mapping the socket will not do it if you are missing the actual docker binary. Try to have your container based on docker-in-docker (dind) image. – Mihai May 05 '19 at 09:53
  • @Mihai [https://stackoverflow.com/a/33003273] this says (dind) should be avoided and that only bind mounting the socket should work. – Kell Maresh May 05 '19 at 10:02
  • of course, but if you ask me I would also not try to change the swarm from within the swarm. In any case, if you don't want to use dind then you have to either manually install docker inside your container or map the binary from your host system (if you are using the same OS of course) inside the container – Mihai May 05 '19 at 10:06

0 Answers0