I am working through the Docker Machine User Guide over at https://docs.docker.com/v1.5/machine/.
It says:
You can see the machine you have created by running the docker-machine ls command again: $ docker-machine ls NAME ACTIVE DRIVER STATE URL dev * virtualbox Running tcp://192.168.99.100:2376 The * next to dev indicates that it is the active host.
When I run this I don't see the * next to any machines. What do I need to do to make the machine be marked as active? Are there any benefits to this?
For example, I am running the Docker Machine on Windows 10, by making it active does it mean I don't have to keep specifying the machine name in my commands such as docker-machine env dev
The operating-system independent way to check whether Docker is running is to ask Docker, using the docker info command. You can also use operating system utilities, such as sudo systemctl is-active docker or sudo status docker or sudo service docker status , or checking the service status using Windows utilities.
Docker Engine accepts docker commands from the CLI, such as docker run <image>, docker ps to list running containers,docker image ls to list images, and so on. Docker Machine is a tool for provisioning and managing your Dockerized hosts (hosts with Docker Engine on them).
Docker network host, also known as Docker host networking, is a networking mode in which a Docker container shares its network namespace with the host machine. The application inside the container can be accessed using a port at the host's IP address (e.g., port 80).
I think just running the following command should work:
$ eval $(docker-machine env default)
(Where default
is the name of the machine).
The reason for the * is to tell you which machine you're currently connected to e.g. if you run docker ps
which Docker engine will it talk to?
In the current version of Docker machine, I believe you have to always specify the name.
Use below command for Docker for Windows Container with Powershell to make machine active:
#Powershell command PS: docker-machine env default #output might me like this $Env:DOCKER_TLS_VERIFY = "1" $Env:DOCKER_HOST = "tcp://172.16.104.171:2376" $Env:DOCKER_CERT_PATH = "C:\Users\username\.docker\machine\machines\default" $Env:DOCKER_MACHINE_NAME = "default" #DOCKER_HOST environmental variable should has same value as default machine PS:$Env:DOCKER_HOST = "tcp://172.16.104.171:2376" # should be same as default machine Env:DOCKER_HOST #Now list docker machines, default will be active. PS: docker-machine ls #default is not active and it look like this. NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * hyperv Running tcp://172.16.104.171:2376 v1.12.3 manager1 - hyperv Running tcp://172.16.104.168:2376 v1.12.3
Dock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With