Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to manage Machine

Shulou Source: shulou.com Published: 2022-06-01 00:51:15 09月19日 Update

Today, I will talk to you about how to manage Machine. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something from this article.

The process of creating machine with docker-machine is simple and suitable for multi-host environments. In addition, Docker Machine also provides some subcommands to facilitate the management of machine. The most common of these is the ability to perform docker-related operations without logging in to machine.

As we learned earlier, to execute a remote docker command, we need to specify the connection string of the target host through-H, such as:

Docker-H tcp://192.168.56.105:2376 ps

Docker Machine makes the process easier. Docker-machine env host1 displays all the environment variables required to access host1:

When prompted, execute eval $(docker-machine env host1):

Then you can see that the command prompt has changed because we previously configured PS1=' [\ u@\ h\ W$ (_ _ docker_machine_ps1)]\ $'in $HOME/.bashrc to display the current docker host.

All docker commands executed in this state have the same effect as on host1, such as starting a busybox container:

Execute eval $(docker-machine env host2) to switch to host2:

Here are a few more useful docker-machine subcommands:

Docker-machine upgrade updates the docker of machine to the latest version, which can be executed in batches:

Docker-machine config views the docker daemon configuration of machine:

Stop/start/restart is an operating system operation on machine, not stop/start/restart docker daemon.

Docker-machine scp can copy files between different machine, such as:

Docker-machine scp host1:/tmp/a host2:/tmp/b

It can be seen that Docker Machine can greatly improve the efficiency in the multi-host environment, and the operation is very simple.

After reading the above, do you have any further understanding of how to manage Machine? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Commands administration hosts content environment procedures prompts configurations differences brevity operating systems between reasons variables characters strings containers that is commonly used copy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno MariaDB vpn macOS