docker-machine env

env

Set environment variables to dictate that docker should run a command against a particular machine.

$ docker-machine env --help

Usage: docker-machine env [OPTIONS] [arg...]

Display the commands to set up the environment for the Docker client

Description:
   Argument is a machine name.

Options:

   --swarm  Display the Swarm config instead of the Docker daemon
   --shell  Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh], default is sh/bash
   --unset, -u  Unset variables instead of setting them
   --no-proxy   Add machine IP to NO_PROXY environment variable

docker-machine env machinename will print out export commands which can be run in a subshell. Running docker-machine env -u will print unset commands which reverse this effect.

$ env | grep DOCKER
$ eval "$(docker-machine env dev)"
$ env | grep DOCKER
DOCKER_HOST=tcp://192.16