Docker Swarm Distribute Build Image

Situation:

I have a docker swarm with two agents. The docker swarm main daemon runs on my manager host (docker-machine example setup) with --strategy random option.

  • Docker creating too many images
  • Docker error when uploading image
  • kitchen-docker: How to run a shell command before kitchen converge
  • Docker node express volume changes in the host not reflected in the container
  • Managing dockers on Windows
  • docker-compose error when I run bundle
  • Steps:

    • I build a new docker image using the docker swarm manager connection
      docker -H tcp://$(docker-machine ip manager):3376 build -t test123 .

    • I startup multiple containers using the manager connection

      docker -H tcp://$(docker-machine ip manager):3376 run -d test123 sleep 20
      docker -H tcp://$(docker-machine ip manager):3376 run -d test123 sleep 20
      docker -H tcp://$(docker-machine ip manager):3376 run -d test123 sleep 20
      docker -H tcp://$(docker-machine ip manager):3376 run -d test123 sleep 20

    The docker container is always executed on the host which was also used for building the image.

    Is there a way to automatically distribute the build image to other hosts?

    I know that i could use a docker registry and just push and pull the image but i want to avoid this.

    Another solution i found was to save the image to a tgz and import it. A import on a docker-swarm host (manager) automatically distributes the image to all agents. (at least this was what i observed)

    Is there maybe another option?

  • how to list the nodes in docker swarm via api call?
  • Connection refused when try to connect http server in docker daemon container
  • Docker Compose: No such image
  • Run a script into a container then copy files to host from the container
  • Strange Vagrant error with Docker and shell provisioners
  • docker vs docker-compose nginx: [emerg] host not found in upstream “httpstat.us” in /etc/nginx/nginx.conf:21
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.