Changes

Jump to: navigation, search

Docker

1,381 bytes added, 16:25, 23 June 2018
Manage machines
==Manage machines==
<br>
 
===List===
Whit the '''ls''' subcommand we can list all the docker-machine managed hosts.
<pre>
# docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
manager - kvm Running tcp://192.168.42.118:2376 v18.05.0-ce
</pre>
* NAME: name of the created machine
* ACTIVE: from Docker point of view, the active virtual host can be managed form the local host, all the '''docker''' commands will be redirected to it. There can be always a single active machine that is marked with an asterisk '*' in the ls output.
* DRIVER:
* STATE:
* URL: The IP address of the virtual host.
* SWARM:
 
===Activate machine===
 
<pre>
One virtual host can be activated with the ''''docker-machine env <machine name>'''' command. Run this command in the host.
<pre>
# docker-machine env manager
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.42.118:2376"
export DOCKER_CERT_PATH="/root/.docker/machine/machines/manager"
export DOCKER_MACHINE_NAME="manager"
# Run this command to configure your shell:
# eval $(docker-machine env manager)
</pre>
 
 
As the output of the env command suggests, you have to run the eval command in the shell that you want to use to managed the active virtual host.
<pre>
# eval $(docker-machine env manager)
</pre>
 
 
Now, in the same shell, run the ls command again:
<pre>
# docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
manager * kvm Running tcp://192.168.42.118:2376 v18.05.0-ce
</pre>

Navigation menu