LinuxCommandLibrary

docker-machine

Manage Docker hosts (e.g., VMs)

TLDR

List currently running Docker machines

$ docker-machine ls
copy

Create a new Docker machine with specific name
$ docker-machine create [name]
copy

Get the status of a machine
$ docker-machine status [name]
copy

Start a machine
$ docker-machine start [name]
copy

Stop a machine
$ docker-machine stop [name]
copy

Inspect information about a machine
$ docker-machine inspect [name]
copy

SYNOPSIS

docker-machine [GLOBAL OPTIONS] COMMAND [COMMAND OPTIONS] [ARGUMENTS…]

PARAMETERS

--debug
    Enable verbose debug output

--tls-ca-cert
    CA certificate for TLS (default ~/.docker/machine/certs/ca.pem)

--tls-ca-key
    CA private key for TLS

--tls-client-cert
    Client certificate for TLS

--tls-client-key
    Client private key for TLS

--tls-verify
    Enable or disable TLS verification (default true)

--github-api-token
    GitHub API token for rate limiting

--native-ssh
    Use native OpenSSH instead of ssh-agent

active [name]
    Set or get the active machine

config [name]
    Print Docker client config for machine

create [--driver driver] [--driver-opts] name
    Create a new machine with specified driver

env [name] [--shell shell]
    Display or set Docker environment vars

inspect name
    Inspect machine details

ip name
    Get machine IP address

kill name
    Kill machine

ls [--filter]
    List machines

provision name
    Re-provision existing machine

regenerate-certs [name] [--force]
    Regenerate TLS certs

restart name
    Restart machine

rm name [--force]
    Remove machine

scp [[user@]machine:]src dest
    Copy files to/from machine

ssh [name] [command]
    SSH into machine

start name
    Start machine

status name
    Get machine status

stop name
    Stop machine

upgrade name
    Upgrade Docker on machine

url [name]
    Get machine Docker daemon URL

version
    Show Docker Machine version

DESCRIPTION

Docker Machine is a command-line tool for provisioning and managing Docker Engine hosts across various platforms. It creates lightweight virtual machines (VMs) or remote servers, installs Docker on them, generates TLS certificates for secure communication, and configures the Docker client environment.

Primarily designed for developers on macOS or Windows needing a Linux Docker host for local development, it supports multiple drivers like VirtualBox, VMware, AWS, Azure, DigitalOcean, Google Cloud, and more. Users can create named machines, start/stop/restart them, SSH into them, run scp, inspect status, and set environment variables for seamless Docker CLI integration.

Workflow example: Create a VM with docker-machine create --driver virtualbox dev, then eval $(docker-machine env dev) to point Docker to it, and run containers. It enables multi-host setups for testing Docker Swarm.

Though powerful for its time, Docker Machine is now deprecated in favor of Docker Desktop, Colima, or native swarm orchestration. It remains useful in legacy environments or CI/CD pipelines requiring isolated Docker hosts.

CAVEATS

Deprecated since Docker 18.09 (2018); prefer Docker Desktop, Podman, or native swarm. Driver support varies by OS; VirtualBox driver common on desktops but requires VBoxManage.

COMMON DRIVERS

virtualbox, vmwarefusion, hyperkit, digitalocean, aws, azure, google, openstack, none

QUICK START

docker-machine create --driver virtualbox dev
docker-machine env dev
eval $(docker-machine env dev)
docker run hello-world

HISTORY

Introduced in Docker 1.6 (2015) as part of Docker Toolbox for non-Linux dev environments. Actively developed until 2017; deprecated March 2019 with Docker 18.09 in favor of Docker Desktop and SwarmKit. Still installable via Homebrew or binaries for legacy use.

SEE ALSO

Copied to clipboard