In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Based on Linux, docker is an open source tool for running applications in which it can be considered a lightweight virtual machine. Docker's logo is a whale carrying a container (the old version of logo), while the new version of logo directly simplifies the details and changes the color, as shown below.
From the picture, you can see the creation of docker and the intentions of the developers. Whales-- hosts, chunks-- isolated containers (what is a docker container later). And the purpose of docker: Build, Ship and Run Any APP,Anywhere. Specifically, it is through the corresponding application component encapsulation, release, deployment, operation and other life cycle management, so as to achieve the purpose of "once packaging, running everywhere" at the application component level.
For example, if you have developed an application software, you can implement it based on docker when you want it to be available anywhere, at any time and in any operating system. Of course, for docker, this component can be an application, a configuration, or even a complete operating system.
Why do I need docker?
In fact, the emergence of docker is a great boon for developers. Imagine that the current or future cloud-based application or software development is separated from the underlying hardware, and users need to have access to relevant resources at any time and anywhere, then docker can provide such a request.
The following is a direct comparison between the docker container and the traditional virtual machine
Characteristic Docker container virtual machine startup speed seconds minute computer performance loss almost no loss loss about half performance close to native weak system support thousands of dozens of isolated resource limits are completely isolated
The core problem of docker is to use containers to achieve functions similar to VM, so as to provide users with more computing resources with more saved hardware resources, and docker is easy to operate, and it can also support flexible automatic creation and deployment through Dockerfile configuration files.
Next, take a look at the comparison between Docker and traditional virtual machine architecture:
Through the above figure, it is found that the virtual machine is isolated at the physical resource level. Compared with the virtual machine, Docker is based on the isolation at the APP level, and saves the virtual machine operating system, thus saving part of the system resources.
The Docker daemon can communicate directly with the main operating system and allocate resources to individual Docker containers; it can also isolate containers from the main operating system (for security) and separate containers from each other. It takes several minutes for the virtual machine to start, while the Docker container can start in milliseconds. Without bloated slave operating systems, Docker can save a lot of disk space and other system resources.
To put it simply, the difference between virtual machines and docker is that virtual machines need to virtualize hardware resources through Hypervisor, while docker directly uses host hardware resources, so the isolation of virtual machines is more thorough, while the isolation of docker takes the second place.
The core concept of Docker 1. Mirror-image
It can be understood as similar to the snapshot in our virtual machine, which is the basis for creating containers. It can be said that there are no mirrors and no containers.
2. Container-container
Running instances created based on images can be started, stopped, and deleted. Each container is isolated and invisible from each other.
3. Warehouse-repository
The place where the image is saved can be understood as the place where the image is hoarded. You can push what you have created to the warehouse, making it easy to pull and use anytime and anywhere.
The warehouse registration server (registry) is the place where the warehouse is stored, which contains multiple repositories, each containing a type of image, and distinguished by a different tag. At present, the largest public repository is Docker Hub, which stores a large number of images for users to download and use.
Here is an additional explanation of the docker architecture:
Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which completes the heavy work of building, running, and distributing the Docker container. The Docker client and daemon can run on the same system, or you can connect the Docker client to the remote Docker daemon. Docker clients and daemons use REST API to communicate on UNIX sockets or network interfaces.
Architecture diagram:
The installation process of Docker
The Linux/ CentOS7-based installation and deployment process is as follows:
Operating system version: centos7.7
1 、 Deployment of environment [root@localhost ~] # hostnamectl set-hostname docker [root@localhost ~] # su [root@docker ~] # cat / etc/RedHat-release CentOS Linux release 7.7.1908 (Core) [root@docker ~] # systemctl stop firewalld & & systemctl disable firewalldRemoved symlink / etc/systemd/system/multi-user.target.wants/firewalld.service.Removed symlink / etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service. [root@docker ~] # setenforce 0 & & sed-I's / ^ SELINUX=.*/SELINUX=disabled/' / etc/selinux/config [root@docker ~] # echo "net.ipv4.ip_forward=1" > / etc/sysctl.conf # enable route forwarding [root@docker ~] # sysctl-p # load route forwarding function net.ipv4.ip_forward=1 [root@docker ~] # systemctl restart network2, Install dependency package [root@docker ~] # yum install-y yum-utils device-mapper-persistent-data lvm2... Update completed: lvm2.x86_64 7VR 2.02.185-2.el7_7.2 upgraded as dependency: device-mapper.x86_64 7VR 1.02.158-2.el7_7.2 device-mapper-event.x86_64 7VR 1.02.158-2.el7_7 .2 device-mapper-event-libs.x86_64 7VR 1.02.158-2.el7_7.2 device-mapper-libs.x86_64 7VR 1.02.158-2.el7_7.2 lvm2-libs.x86_64 7VR 2.02.185-2.el7_7.2 over!
Description:
The yum-utils package is installed to provide a yum-config-manager unit, and the device-mapper-persistent-data and lvm2 installed at the same time are used to store the two packages necessary for device mapping.
3. Set a stable repository [root@docker ~] # yum-config-manager-- add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo has loaded the plug-in: fastestmirror Langpacksadding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repograbbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to / etc/yum.repos.d/docker-ce.reporepo saved to / etc/yum.repos.d/docker-ce.repo [root@docker ~] # ls / etc/yum.repos.d/ # check whether a docker source CentOS-Base.repo CentOS-Debuginfo has been added .repo CentOS-Media.repo CentOS-Vault.repoCentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo4 、 Install docker engine [root@docker ~] # yum install-y docker-ce... Installed: docker-ce.x86_64 3 container-selinux.noarch 19.03.8-3.el7 is installed as a dependency: container-selinux.noarch 2 container-selinux.noarch 2.107-3.el7 containerd.io.x86_64 0 container-selinux.noarch 1.2.13-3.1.el7 docker-ce-cli. X86'64 1 19.03.8-3.el7 over! 5. Create a docker directory and configure the image acceleration service [root@docker ~] # mkdir / etc/docker-p [root@docker ~] # tee / etc/docker/daemon.json "registry-mirrors": ["https://5m9y9qbl.mirror.aliyuncs.com"]>} > EOF {" registry-mirrors ": [" https://5m9y9qbl.mirror.aliyuncs.com"]} "
Description: tee command-write from standard input to file and standard output, that is, copy the standard input data to each file FILE and send it to standard output at the same time.
6. Start the service View version [root@docker ~] # systemctl daemon-reload [root@docker ~] # systemctl restart docker.service [root@docker ~] # docker-vDocker version 19.03.8 Build afacb8b [root@docker ~] # docker versionClient: Docker Engine-Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:27:04 2020 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine-Community Engine: Version: 19.03.8 API version: 1. Go version: go1.12.17 Git commit: afacb8b Built: Wed Mar 11 01:25:42 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0 .18.0 GitCommit: fec3683 summary
This paper mainly introduces the function of docker, compares it with the traditional virtual machine, and compares it with the traditional virtual machine at the architecture level, then describes the three core components of docker, and finally gives the installation process of docker in the Centos7 operating system based on Linux.
Original address: https://www.linuxprobe.com/docker-logo.html
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.