【Docker】Docker Machine

Posted by 西维蜀黍 on 2022-02-27, Last Modified on 2022-04-05

What’s the difference between Docker Engine and Docker Machine?

When people say “Docker” they typically mean Docker Engine, the client-server application made up of the Docker daemon, a REST API that specifies interfaces for interacting with the daemon, and a command line interface (CLI) client that talks to the daemon (through the REST API wrapper). Docker Engine accepts docker commands from the CLI, such as docker run <image>, docker ps to list running containers, docker image ls to list images, and so on.

Docker Machine is a tool for provisioning and managing your Dockerized hosts (hosts with Docker Engine on them). Typically, you install Docker Machine on your local system. Docker Machine has its own command line client docker-machine and the Docker Engine client, docker. You can use Machine to install Docker Engine on one or more virtual systems. These virtual systems can be local (as when you use Machine to install and run Docker Engine in VirtualBox on Mac or Windows) or remote (as when you use Machine to provision Dockerized hosts on cloud providers). The Dockerized hosts themselves can be thought of, and are sometimes referred to as, managed “*machines*”.

IP

If you are using Docker Machine, you can get the manager IP with either docker-machine ls or docker-machine ip <MACHINE-NAME> — for example, docker-machine ip manager1.

The tutorial uses manager1 : 192.168.99.100.

How to Connect to Docker Daemon

Add a host without a driver

You can register an already existing docker host by passing the daemon url. With that, you can have the same workflow as on a host provisioned by docker-machine.

# via TCP
$ docker-machine create --driver none --url=tcp://192.168.18.168:2376 default3

# via SSH
$ docker-machine create --driver none --url=ssh://192.168.18.10:31565 default4


Refer to https://swsmile.info/post/docker-daemon/ for how to config Docker Daemon

Reference