Running multiple docker-linkers (one per machine)

I am testing a lot of micro services. I group some of them in a file to create dockers, for example:

agent: image: php:fpm volumes: - ./GIT:/reposcm:ro expose: - 9000 links: - elastic elastic: image: elasticsearch expose: - 9200 - 9300 

Then I start first on $docker-compose up

In another directory, I would run another "microservice" on $docker-compose up . But I get:

 ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`. 

How can I specify a docker machine for docker-compose.yml?

 $docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM default - virtualbox Running tcp://192.168.99.101:2376 my_test - virtualbox Running tcp://192.168.99.102:2376 

Only the default machine can run a microservice.

How to specify the target machine docker-compose.yml ?

+5
source share
1 answer

Make sure that in the shell you want to run the second docker assembly, you did docker-machine env first :

 docker-machine env <machine name> eval "$(docker-machine env <machine name>) 

This will set up the correct environment variables for the docker teams to communicate with the right machine (right docker daemon).

+4
source

Source: https://habr.com/ru/post/1242078/


All Articles