Jerome
Jerome

Reputation: 1192

How to do a "docker-compose" in a "docker machine"?

I want to test something and I need to create containers in each docker machines I have. So on my local host I have a lot of containers and 2 machines (vbox-t and vbox-t2).

I can't find in documentation how to connect in a machine and create containers inside. Someone can help me ?

[EDIT] I have found this on Docker documentation:

Use Machine to run Docker containers To run a Docker container, you:

create a new (or start an existing) Docker virtual machine
switch your environment to your new VM
use the docker client to create, load, and manage containers
Once you create a machine, you can reuse it as often as you like. Like any VirtualBox VM, it maintains its configuration between uses.

The examples here show how to create and start a machine, run Docker commands, and work with containers.

But how to switch my environment ?

Upvotes: 1

Views: 122

Answers (1)

panagdu
panagdu

Reputation: 2133

To make sure our Docker client talks to the Docker engine in your vbox-t machine you need to run

eval $(docker-machine env vbox-t)

To restore just use:

eval "$(docker-machine env -u)"

This will remove the DOCKER_* variables so your docker commands will connect to your local env.

Upvotes: 1

Related Questions