Commands

Docker Machine Commands

Docker Machine has multiple commands in order to manage a machine.

For more available options to manage a Docker Machine, use docker-machine help.

Rancher Machine Commands

If you are using Ionos Cloud Docker Machine Driver with Rancher Machine, use rancher-machine help to see the available commands.

Examples

List Machines

To list the machines you have created, use the command:

docker-machine ls

It will return information about your machines, similar to this:

NAME           ACTIVE   DRIVER         STATE     URL                         SWARM   DOCKER    ERRORS
test-machine   *        ionoscloud     Running   tcp://158.222.102.154:2376           v20.10.5

Start a Machine

To start a Docker Machine, run:

docker-machine start test-machine

Expected output:

Starting "test-machine"...
Machine "test-machine" was started.
Waiting for SSH to be available...
Detecting the provisioner...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

Stop a Machine

To stop a Docker Machine, run:

docker-machine stop test-machine

Expected output:

Stopping "test-machine"...
Machine "test-machine" was stopped.

Restart a Machine

To restart a Docker Machine, run:

docker-machine restart test-machine

Expected output:

Restarting "test-machine"...
Waiting for SSH to be available...
Detecting the provisioner...
Restarted machines may have new IP addresses. You may need to re-run the `docker-machine env` command.

Get Status

To get the status of a Docker Machine created, run:

docker-machine status test-machine

Remove a Machine

To remove a Docker Machine and all the resources associated with it, run:

docker-machine rm test-machine

It should produce results similar to this:

About to remove test-machine
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
(test-machine) Starting deleting resources...
(test-machine) NIC Deleted
(test-machine) Volume Deleted
(test-machine) Server Deleted
(test-machine) LAN Deleted
(test-machine) DataCenter Deleted
(test-machine) IPBlock Deleted
Successfully removed test-machine

The remove command can also be used with --force or -f flag.

Last updated