In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I. Overview of docker machine
Before Docker Machine is released, you may encounter the following problems:
① you need to log in to the host and follow the host and operating system-specific installation and configuration steps to install Docker so that it can run the Docker container.
② you need to develop a set of tools to manage multiple Docker hosts and monitor their status.
③ you develop locally, and the product is deployed on the public cloud platform. You want to minimize the difference between the two environments.
The emergence of Docker Machine solves the above problems.
① Docker Machine simplifies the complexity of deployment, whether on the local virtual machine or on the public cloud platform, the Docker host can be built with only one command
② Docker Machine provides centralized management of multi-platform and multi-Docker hosts
③ Docker Machine makes it easy for applications to migrate from the local to the cloud, and you only need to modify the environment variables to communicate with any Docker host to deploy the application.
2. Docker machine deploys docker on remote hosts
Environment:
Docker-machine host: 192.168.1.9 docker version: docker-cedocker host: 192.168.1.10
Steps:
① updates curl
Yum update curl-y
② install docker-machine
For installation, please refer to the official website of docker-machine
Linux download path:
The copy code is as follows: curl-L https://github.com/docker/mac...uname-s-uname-m > / tmp/docker-machine & & install / tmp/docker-machine / usr/local/bin/docker-machine
Just copy and paste and install as needed.
[root@node1 ~] # docker-machine-vdocker-machine version 0.13.0, build 9ba6da9
③ creates ssh key pairs to realize secret login between two hosts.
[root@node1 ~] # ssh-keygen [root@node1 ~] # ssh-copy-id 192.168.1.10
④ downloads more mirror sources locally to avoid not finding the package when creating the machine
[root@node1 ~] # wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/rep... # this is the Ali Cloud centos7 image source [root@node1 ~] # yum install epel-release # third party source
⑤ opens machine communication port
[root@node1] # firewall-cmd-- add-port=2376/tcp-- permanent [root@node1] # firewall-cmd-- reload
⑥ creates a docker host and names it host1
[root@node1] # docker-machine create-d generic--generic-ip-address=192.168.1.10 host1Running pre-create checks...Creating machine... (swarm-master) No SSH key specified. Assuming an existing key at the default location.Waiting for machine to be running, this may take a few minutes...Detecting operating system of created instance...Waiting for SSH to be available...Detecting the provisioner...Provisioning with centos...Running... [root@node1 ~] # docker-machine lsNAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORShost1-generic Running tcp://192.168.1.10:2376 v17.12.1-ce
⑦ changes the docker environment variable
[root@node1 ~] # docker-machine env host1export DOCKER_TLS_VERIFY= "1" export DOCKER_HOST= "tcp://192.168.1.10:2376" export DOCKER_CERT_PATH= "/ root/.docker/machine/machines/host1" export DOCKER_MACHINE_NAME= "host1" # Run this command to configure your shell: # eval $(docker-machine env host1) [root@node1 ~] # eval $(docker-machine env host1)
⑧ runs the container to see if both ends are synchronized
[root@node1 ~] # docker run-d busybox [root@node1 ~] # docker-machine ssh host1 [root@host1 ~] # docker image lsREPOSITORY TAG IMAGE ID CREATED SIZEbusybox latest f6e427c148a7 6 days ago 1.15MB [root@host1 ~] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES8d9b5005a264 busybox "sh" 17 seconds ago Up 16 seconds ago modest_ joliot [root @ host1 ~] # exit [root@node1 ~] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES8d9b5005a264 busybox "sh" 57seconds ago Up 16 seconds ago modest_joliot
Synchronization test of mirror container was successful
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.