Skip to content

Instantly share code, notes, and snippets.

@dungdt88
Last active March 30, 2016 09:27
Show Gist options
  • Save dungdt88/74dea72c39c66822535742ff590e8bb1 to your computer and use it in GitHub Desktop.
Save dungdt88/74dea72c39c66822535742ff590e8bb1 to your computer and use it in GitHub Desktop.
Manage docker on remote hosts with docker-machine

To set environment to manage a remote host

eval "$(docker-machine env dev)"

In which dev must be already registered in docker-machine. Says IP address of dev machine is 192.168.99.101, and API is exposed on port 2376, then the command above is equivalent to following commands:

DOCKER_HOST=tcp://192.168.99.101:2376
DOCKER_CERT_PATH=/path/to/pem
DOCKER_TLS_VERIFY=1
DOCKER_MACHINE_NAME=dev

To unset environment and set to local host

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

The command above is equivalent to the following commands:

unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment