Docker machine: what is and the main commands
Igor Souto
Posted on July 5, 2020
Docker machine allows us to easily deploy an environment from a local machine in any infrastructure service, like AWS, DigitalOcean, Google Cloud, etc, through the installation of the driver that you want, environment variables, etc.
With that, we can create a host Docker in any of these platforms, and easily manage those machines from our local machine.
Main commands
CREATE
docker-machine create --driver virtualbox first-host-box
This command, creates a new host docker, with the driver VirtualBox and with the name "first-host-box".
LS
docker-machine ls
Lists all the available hosts in your machine.
ENV
Lists the environment variables that need to be set.
We can easily declare it with:
eval $(docker-machine env first-host-box)
IP
docker-machine ip first-host-box
Lists the ip of the host docker.
SSH
docker-machine ssh first-host-box
With this command, we can access via SSH this host docker and use Linux commands inside it.
INSPECT
docker-machine inspect first-host-box
Shows details of the host docker.
STOP
docker-machine stop first-host-box
Stops the host.
START
docker-machine start first-host-box
Starts the host.
RM
docker-machine rm first-host-box
Removes the host.
Conclusion
With this, the Docker machine promotes great ease of installation and deployment in a cloud environment from its local containers.
Posted on July 5, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.