I'm using docker-compose and docker swarm. I have created a docker-mgt server from which I did a docker-machine to setup a swarm cluster consisting of a swarm master and two swarm-agents.
I have created an Express app that gets started in a container and it seems the swarm master decided to have it on agent1. Then I have also a Wordpress site (example from the docker compose site) that I'm running with docker-compose on Docker Swarm.
cloud-user@docker-mgt:~/wordpress$ docker-compose up
wordpress_db_1 is up-to-date
Creating wordpress_web_1
ERROR: Error: image library/wordpress_web:latest not found
The following images are available:
cloud-user@docker-mgt:~/wordpress$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
orchardup/php5 latest c385b8a81cee 18 months ago 330.1 MB
swarm latest a9975e2cc0a3 19 hours ago 17.15 MB
orchardup/mysql latest 5a45a5a953bb 16 months ago 292.4 MB
wordpress_web latest e484f88dc8c8 11 minutes ago 350.9 MB
node-ip latest d177af00338b 39 minutes ago 549.5 MB
centos centos6 1a895dd3954a 8 weeks ago 190.6 MB
So it does have the wordpress_web:latest available and still it complains.
When running this wordpress app on a seperate docker host (not part of the swarm cluster) it runs just fine. To exclude a mistake on the wordpress app, I also tried another complete different app consisting of two containers (with docker-compose) and it is exactly the same issue.
I'm beginning to think that docker compose and swarm can not work together smoothly but that's hard to believe of course.
The problem is that swarm needs some way to retrieve the image to run the container. If the image doesn't exist in a registry (or the docker hub) then it doesn't (currently) have any way to get that image , and you end up with this error.
One option is to tag the images with a full name and push them to the hub. Then swarm will be able to pull the images on all the nodes.
Another options is to propagate the image using docker save
and docker load
, which will send the image to all nodes.
Another option is to add an image affinity to force the container to run on the node that has the image.
In the future, swarm should gain the ability to propagate images between nodes.