7,540
edits
Changes
Docker
,→Activate machine
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
manager * kvm Running tcp://192.168.42.118:2376 v18.05.0-ce
</pre>
In the same shell on the host machine, create a docker container:
<pre>
# docker run -d -i -t --name container1 ubuntu /bin/bash
9dfda56f7739831b0d19c8acd95748b1c93f6c6bb82d2aa87cfb10ecee0e4f28
</pre>
Now we will log on to the virtual host with the '''ssh <machine name>''' command.
<pre>
# docker-machine ssh manager
## .
## ## ## ==
## ## ## ## ## ===
/"""""""""""""""""\___/ ===
~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~
\______ o __/
\ \ __/
\____\_______/
_ _ ____ _ _
| |__ ___ ___ | |_|___ \ __| | ___ ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__| < __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 18.05.0-ce, build HEAD : b5d6989 - Thu May 10 16:35:28 UTC 2018
Docker version 18.05.0-ce, build f150324
#
<pre>
List the available docker containers. We should see there the newly created '''container1'''. The '''docker run''' command was executed in the host, bat was run in the remote, virtual host.
<pre>
docker@manager:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9dfda56f7739 ubuntu "/bin/bash" 5 minutes ago Up 5 minutes container2
</pre>
===Unset active machine===
The active machine can be unset with the "'''--unset'''" switch. Once the active docker machine was unset, the docker client will manage the local docker daemon again.
<pre>
# docker-machine env --unset
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
# Run this command to configure your shell:
# eval $(docker-machine env --unset)
</pre>
As the output suggest, we have to run the eval command again with the '''--unset''' switch to clear the shell. Alternatively you can just start a new shell.
<pre>
# eval $(docker-machine env --unset)
</pre>
Now lets run the ps command again. As the docker client now connected to the local docker daemon, we shouldn't see the container1 docker container anymore in the list.
<pre>
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
66e9cfbbc947 busybox "sh" 30 hours ago Up 4 minutes critcon
</pre>