In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
What is docker?
Docker is an open source application container engine, developers can package their applications into containers, and then migrate to docker applications on other machines to achieve rapid deployment. If a failure occurs, the service can be quickly restored through mirroring.
Docker installation
Environmental preparation
Operating system: CentOS 7.6.1810
Software source: Aliyun image (the software source of docker-ce can be found on Aliyun image station, and the speed of using domestic source is relatively fast)
Install docker-ce
If you do not have a physical machine, you can first use a virtual machine to learn. Operating system installation, skip (many online tutorials).
1. Installation dependency
Docker relies on some of the necessary tools of the system and can be installed in advance.
Yum install-y yum-utils device-mapper-persistent-data lvm2
2. Add software sources
Yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
3. Install docker-ce
Yum clean all yum makecache fastyum-y install docker-ce
4. Start the service
Start the service through systemctl
Systemctl start docker
5. View the installation version
The installation is successful, and you can use docker version to check the current version after starting the service.
I. preparatory work
Two separate network cards are required across hosts:
Server1 and server2 add network card
[root@localhost ~] # ip addr show to check whether the network card has been added successfully
Added successfully.
Macvlan itself is a module of linxu kernel and is essentially a network card virtualization technology. Its function is to allow multiple network cards to be virtual on the same physical network card, and to forward network data in the data link layer through different MAC addresses. A network card is configured with multiple MAC addresses (that is, multiple interface). Each interface can configure its own IP,Docker macvlan network is actually using the macvlan drive provided by Linux. Because network packets with multiple MAC addresses are transmitted from the same network card, you need to turn on the promiscuous mode ip link set eth2 promisc on of the network card.
Open the promiscuous mode of the ens37 Nic for server1 and server2 and run the following command on server1 and server2:
[root@localhost ~] # ip link set ens37 promisc on
[root@localhost ~] # ip addr show ens37 # check whether the promiscm function is enabled
Note: if the promiscuous mode is not enabled, the macvlan network will not be able to access the outside world
Specifically, when vlan is not used, it is shown that it is impossible to ping the route and ping to other hosts in the same network.
Create macvlan networks on each of the two hosts
Creating a macvlan network is different from bridging mode, you need to specify network segments and gateways (because you want to ensure that the cross-host segments and gateways are the same), and they all have to be real.
[root@localhost] # docker network create-d macvlan-- subnet 172.16.36.0 parent=ens37 macvlan 24-- gateway 172.16.36.254-o parent=ens37 macvlan # create a network called macvlan
[root@localhost ~] # docker network ls # View local network information
Create a docker container
Server1:
[root@localhost] # docker run-it-- name vm01-- network=macvlan-- ip=172.16.36.101 centos
[root@1f89fd5f37ff /] # ip addr
[root@1f89fd5f37ff /] # ping 172.16.36.100
Server2:
[root@localhost] # docker run-it-- name vm02-- network=macvlan-- ip=172.16.36.100 centos
[root@e8da7e4ef2b3 /] # ip addr
[root@e8da7e4ef2b3 /] # ping 172.16.36.101
Cross-host communication is thus configured.
DNS Settin
After the cross-host communication is set up successfully, the container may need to go online to download the data. So now set DNS, and configure it as follows:
Modify the daemon.json file in the path / etc/docker/, and add the following:
"dns": [
"172.16.1.1"
"202.96.128.166"
]
Note: the installation software is the daemon.json file directly modified by docker, and the daemon.json file is created if the installation software is docker-ce.
Test:
Add:
In the course of use, after it is found that the host host is rebooted, macvlan mode will automatically shut down, resulting in no communication between containers using this feature.
PROMISC status was not found to be UP
The promisc function needs to be turned on manually to resume communication.
[root@localhost ~] # ip link set ens37 promisc on # enable promisc function
[root@localhost ~] # ip addr show ens37 # View the Nic information of the Nic ens37
[root@localhost ~] # docker exec-it vm02 / bin/bash # login container
[root@8cb8828007cf /] # ping 172.16.36.100 # Connectivity Test
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.