2.16. Docker Machine

发布时间 :2025-10-25 12:31:06 UTC      

2.16.1. Brief introduction

Docker Machine is a tool that allows you to install Docker on a virtual host and use the docker-machine command to manage the host.

Docker Machine can also centrally manage all docker hosts, such as quickly installing docker on 100 servers.

Image0

The virtual hosts managed by Docker Machine can be on-board or cloud providers, such as Aliyun, Tencent Cloud, AWS, or DigitalOcean.

Using the docker-machine command, you can start, check, stop, and restart the managed host, upgrade Docker clients and daemons, and configure the Docker client to communicate with your host.

Image1

2.16.2. Installation

You need to install Docker before installing Docker Machine.

Docker Machine can be installed on a variety of 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 a Windows platform, you can use the 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 to see if the installation was successful:

$ docker-machine version
docker-machine version 0.16.0, build 9371605

2.16.3. Use

This chapter introduces the use of docker-machine through virtualbox. Other cloud service providers operate in the same way. You can refer to the guidance document of each service provider for details.

1. List the available machines

You can see that there is currently only the default default virtual machine here.

$ docker-machine ls

` <../wp-content/uploads/2019/11/docker-machine1.png>` __

2. Create a machine

Create a machine called test.

$ docker-machine create --driver virtualbox test
  • –driver Specifies the type of driver used to create the machine, in this case virtualbox.

` <../wp-content/uploads/2019/11/docker-machine2.png>` __

3. Check the ip of the machine

$ docker-machine ip test

` <../wp-content/uploads/2019/11/docker-machine3.png>` __

4. Stop the machine

$ docker-machine stop test

` <../wp-content/uploads/2019/11/docker-machine4.png>` __

5. Start the machine

$ docker-machine start test

` <../wp-content/uploads/2019/11/docker-machine5.png>` __

6. Enter the machine

$ docker-machine ssh test

` <../wp-content/uploads/2019/11/docker-machine6.png>` __

Docker-machine command parameter description

  • docker-machine active View the Docker host that is currently active.

$ 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 Displays the environment variables required to connect to a host

  • inspect : output the details 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 management hosts

  • provision Reconfigure the specified host

  • regenerate-certs Regenerate TLS information for a host

  • restart Restart the specified host

  • rm Delete a Docker host, and the corresponding virtual machine will also be deleted

  • ssh Connect to the host through SSH and execute the command

  • scp Remote replication of data through scp between Docker hosts and between Docker hosts and local hosts

  • mount Use SSHFS to mount or unmount directories from your computer

  • start Start a specified Docker host, and if the object is a virtual machine, the virtual machine 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 Display the version of Docker Machine or the version of host Docker

  • help : show help information

Principles, Technologies, and Methods of Geographic Information Systems  102

In recent years, Geographic Information Systems (GIS) have undergone rapid development in both theoretical and practical dimensions. GIS has been widely applied for modeling and decision-making support across various fields such as urban management, regional planning, and environmental remediation, establishing geographic information as a vital component of the information era. The introduction of the “Digital Earth” concept has further accelerated the advancement of GIS, which serves as its technical foundation. Concurrently, scholars have been dedicated to theoretical research in areas like spatial cognition, spatial data uncertainty, and the formalization of spatial relationships. This reflects the dual nature of GIS as both an applied technology and an academic discipline, with the two aspects forming a mutually reinforcing cycle of progress.