Docker Machine
Docker Machine was an early Docker tool for creating and managing Docker hosts, but with the maturity of Docker Desktop, Terraform, and Kubernetes, it has completed its historical mission and has been fully replaced.
In local development scenarios, Docker Desktop has fully replaced Docker Machine and is no longer suitable for practical use.
| Comparison Item | Docker Machine | Docker Desktop |
|---|---|---|
| Product positioning | Tool for creating and managing Docker hosts | Integrated local Docker development environment |
| Main Use | Create a VM and install Docker Engine | Run Docker directly on the local machine |
| Typical era of use | Early Docker (1.x - 18.x) | Current mainstream |
| macOS / Windows support | Indirect (depends on VirtualBox) | Native support |
| Whether additional virtualization software is required | Yes (VirtualBox / VMware) | No (built-in) |
| Docker Engine management | Manual / semi-automatic | Fully automatic |
| Complexity of use | High | Low |
| Whether a GUI is provided | No | Is |
| Kubernetes support | Not supported | Optional, built-in |
| Multiple Docker host management | Supported | Not supported (focused on single machine) |
| Suitable for production environments | Not suitable | Not suitable |
| Official maintenance status | Basically no longer updated | Continuously active |
| Current recommendation level | Not recommended | Strongly recommended |
Introduction
Docker Machine is a tool that lets you install Docker on virtual hosts and manage those hosts with the docker-machine command.
Docker Machine can also centrally manage all your docker hosts, for example quickly installing docker on 100 servers.

The virtual hosts managed by Docker Machine can be local machines or cloud providers such as Alibaba Cloud, Tencent Cloud, AWS, or DigitalOcean.
With the docker-machine command, you can start, inspect, stop, and restart managed hosts, upgrade the Docker client and daemon, and configure the Docker client to communicate with your hosts.

Installation
Before installing Docker Machine, you need to install Docker first.
Docker Machine can be installed and used on multiple platforms, including Linux, macOS, and Windows.
Linux installation command
$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
sudo mv /tmp/docker-machine /usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
macOS installation command
$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/usr/local/bin/docker-machine &&
chmod +x /usr/local/bin/docker-machine
Windows installation command
If you are on the Windows platform, you can use Git BASH, and enter the following command:
$ base=https://github.com/docker/machine/releases/download/v0.16.0 &&
mkdir -p "$HOME/bin" &&
curl -L $base/docker-machine-Windows-x86_64.exe > "$HOME/bin/docker-machine.exe" &&
chmod +x "$HOME/bin/docker-machine.exe"
Check whether it was installed successfully:
$ docker-machine version
docker-machine version 0.16.0, build 9371605
Note:The release notes for each version also contain installation instructions:https://github.com/docker/machine/releases
Use
This chapter introduces the use of docker-machine through VirtualBox. Operations for other cloud providers are basically the same. For details, refer to each provider's guide documentation.
1. List available machines
You can see that currently there is only the default virtual machine here.
$ docker-machine ls
2. Create a machine
Create a machine named test.
$ docker-machine create --driver virtualbox test
- --driver: Specifies the driver type used to create the machine, here it is virtualbox.
3. View the machine's IP
$ docker-machine ip test
4. Stop the machine
$ docker-machine stop test

5. Start the machine
$ docker-machine start test
6. Log into the machine
$ docker-machine ssh test
docker-machine command parameter description
-
docker-machine active: View the currently active Docker host.
$ docker-machine ls
NAME ACTIVE DRIVER STATE URL dev - virtualbox Running tcp://192.168.99.103:2376 staging * digitalocean Running tcp://203.0.113.81:2376
$ echo $DOCKER_HOST tcp://203.0.113.81:2376
$ docker-machine active staging
- config: View the connection information of the currently active Docker host.
- create: Create a Docker host
- env: Show the environment variables needed to connect to a host
- inspect: Output detailed information of the specified Docker in json format
- ip: Get the address of the specified Docker host
- kill: Directly kill the specified Docker host
- ls: List all managed hosts
- provision: Reconfigure the specified host
- regenerate-certs: Regenerate TLS information for a host
- restart: Restart the specified host
- rm: Delete a Docker host; the corresponding virtual machine will also be deleted
- ssh: Connect to a host via SSH and execute commands
- scp: Remotely copy data between Docker hosts and between a Docker host and the local host via scp
- mount: Mount or unmount directories from a computer using SSHFS
- start: Start a specified Docker host; if the target is a virtual machine, it will be started
- status: Get the status of the specified Docker host (including: Running, Paused, Saved, Stopped, Stopping, Starting, Error, etc.)
- stop: Stop a specified Docker host
- upgrade: Update the Docker version of a specified host to the latest
- url: Get the listening URL of the specified Docker host
- version: Show the Docker Machine version or the host's Docker version
- help: Show help information




