In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Docker concept
Docker is an open source application container engine that allows developers to package their applications and dependency packages into a portable container, publish them to any popular Linux machine, and virtualize them. Containers are fully sandboxed and will not have any interface with each other.'
A complete Docker consists of the following parts:
DockerClient client
Docker Daemon daemon
Docker Image Mirror
DockerContainer container
The difference between Docker and virtual machine:! Similarities: ① can be migrated between different hosts; ② has root permissions; ③ can be controlled remotely; ④ has backup and rollback operations.! Differences: * * 1, operating system: * * docker: it has advantages in performance and can easily run multiple operating systems; virtual machine: any system can be installed, but the performance is not as good as the container. * * 2. Principle: * * docker: share the kernel with the host. All containers run on the container engine. The container is not a complete operating system. All containers share the operating system and are isolated at the process level. Virtual machine: each virtual machine is built on virtual hardware, provides instruction-level virtualization, and has a complete operating system. * * 3. Advantages: * * docker: efficient and centralized. A hardware node can run hundreds of containers, which is very resource-saving. QoS will try its best to satisfy it, but it is not guaranteed. The kernel is upgraded by the provider and the service is managed by the service provider. Virtual machine: has absolute authority to the operating system and complete administrative authority to the system version and system upgrade. Has a complete set of resources: CPU, RAM, and disk. QoS is guaranteed, and each virtual machine is like a real physical machine, which can realize different operating systems running on the same physical node. * * 4. Disadvantages: * * docker: there is no permission to control the kernel. Only the provider of the container has the permission to upgrade. With only one kernel running on the physical node, it is almost impossible to mix different operating systems. Container providers generally provide only a few operating systems. Virtual machines: each virtual machine has a greater load and consumes more resources, and users need full maintenance and management. The number of virtual machines that can run on a physical machine is very limited. (3) Docker usage scenarios: 1. Simplify deployment of packaged applications; 2. Migrate servers without underlying hardware; for example, migrate servers from Tencent Cloud to Aliyun. (4) Docker core concept: image container repository
-deploy version 19 docker
# install software package, storage mapping and other dependent packages yum install yum-utils device-mapper-persistent-data lvm2-y # set Ali cloud image source yum-config-manager-- add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo# install docker-ce engine yum install-y docker-ce# disable firewall Open docker [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0 [root@localhost ~] # systemctl start docker# public repository to search nginx image [root@localhost ~] # docker search nginxNAME DESCRIPTION STARS OFFICIAL AUTOMATEDnginx Official build of Nginx. 12370 # downloads [OK] jwilder/nginx-proxy Automated Nginx reverse proxy for docker con... 1703 [OK] # Image acceleration # tee standard input to daemon.json Point to Aliyun's image acceleration address tee / etc/docker/daemon.json chen01.txt [root@e95aad3dee7a data1] # lschen01.txt [root@e95aad3dee7a data1] # exitexit [root@localhost ~] # cd / var/www/ [root@localhost www] # lschen01.txt [root@localhost www] # cat chen01.txt 12 volume data volume container [root@localhost www] # docker run-name web100-v / data1-v / data2-it centos / bin/bash [root@a0687fef8d8f /] # lsbin Data2 etc lib lost+found mnt proc run srv tmp vardata1 dev home lib64 media opt root sbin sys usr [root@a0687fef8d8f /] # cd data1 [root@a0687fef8d8f data1] # echo "111" > 111.txt [root@a0687fef8d8f data1] # cd.. / data2/ [root@a0687fef8d8f data2] # echo" 222" > 222.txt [root@a0687fef8d8f data2] # exit# new container is mounted to the web100 container we just created Web100 provides two shared directories [root@localhost www] # docker run-it-- volumes-from web100-it centos / bin/bash [root@7a360567847b /] # lsbin data2 etc lib lost+found mnt proc run srv tmp vardata1 dev home lib64 media opt root sbin sys usr [root@7a360567847b /] # cd data1/ [root@7a360567847b data1] # ls111.txt [root@7a360567847b data1] # cd.. / data2/ [root@7a360567847b data2] # ls222.txt# port mapping,-P random port mapping -p specify the self-set mapping port docker run-d-P httpd:centosdocker run-d-p 23764 httpd:centos 80 httpd:centos container interconnect (using centos image) # create and run the container named web1 Automatic mapping of port numbers docker run-itd-P-- name web1 centos / bin/bash # create and run the container name web2docker run-itd-P-name web2-- link web1:web1 centos / bin/bash into the web2 container ping web1 [root@localhost ~] # docker ps-aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESca605a29a8f5 centos "/ bin/bash" 15 seconds ago Up 11 seconds web20e46fd7a0f96 centos "/ bin/bash" 42 seconds ago Up 41 seconds web1 [root@localhost ~] # docker exec it ca605a29a8f5 / bin/bashError: No such container: it [root@localhost ~] # docker exec-it ca605a29a8f5 / bin/bash [root@ca605a29a8f5 / ] # ping web1PING web1 (172.17.0.2) 56 (84) bytes of data.64 bytes from web1 (172.17.0.2): icmp_seq=1 ttl=64 time=0.087 ms64 bytes from web1 (172.17.0.2): icmp_seq=2 ttl=64 time=0.120 ms64 bytes from web1 (172.17.0.2): icmp_seq=3 ttl=64 time=0.046 ms64 bytes from web1 (172.17.0.2): icmp_seq=4 ttl=64 time=0.060 ms64 bytes from web1 (172.17.0.2): icmp_seq=5 ttl=64 time=0.051 ms
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.