Docker Community Forums

Share and learn in the Docker community.

What is the relationship between docker swarm and docker-machine

docker

(knnleow) #1

tried test my docker-compose.yml on docker swarm.
follow the document and create swarm with two nodes.
test commands and all functioning correctly.

however, when i try to docker-compose, ERROR show docker-machine not configured.
please advice what i did wrong here.
please help me understand why docker-machine is needed since swarm is already doing the clustering work.

Precheck on my ENV
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
85ayvlol5rulaxw9c34o9h0un * knnubt98nn Ready Active Leader
e46f5hida99w1i4gwi9zpdv2m knnubt99nn Ready Active
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
$ docker-machine env
Error: No machine name(s) specified and no “default” machine exists.
$

Try Docker Compose
$ eval “$(docker-machine env --swarm knnubt98nn)” && docker-compose up
Host does not exist: "knnubt98nn"
WARNING: The Docker Engine you’re using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All         containers will be scheduled on the current node.

To deploy your application across the swarm, use the bundle feature of the Docker experimental  build.

More info:
https://docs.docker.com/compose/bundles

Creating network "myword01swarm_default" with the default driver
Pulling mysql (mysql:5.7)...
5.7: Pulling from library/mysql
6a5a5368e0c2: Pull complete
0689904e86f0: Pull complete
: