龙空技术网

docker安装

小牛同学走江湖 30

前言:

此刻我们对“centos72安装docker”大约比较注意,大家都需要学习一些“centos72安装docker”的相关资讯。那么小编在网摘上汇集了一些对于“centos72安装docker””的相关知识,希望各位老铁们能喜欢,看官们一起来了解一下吧!

docker名词

镜像(image)

docker镜像就好比是一个模板,可以通过这个模板来创建容器服务,tomcat镜像===》run==》tomcat01容器(提供服务器),通过这个镜像可以创建多个容器(最终服务运行或者项目运行就是在容器中的)

容器(container)

docker利用容器技术,独立运行一个或者一个组应用,通过镜像来创建的

启动,停止,删除,基本命令

目前就可以吧这个容器理解为一个简易的linux系统

仓库(repository)

仓库就是存放镜像的地方

仓库分为公有仓库和私有仓库

看一下配置以供参考

[root@localhost ~]# uname -r3.10.0-514.el7.x86_64[root@localhost ~]# cat /etc/os-releaseNAME="CentOS Linux"VERSION="7 (Core)"ID="centos"ID_LIKE="rhel fedora"VERSION_ID="7"PRETTY_NAME="CentOS Linux 7 (Core)"ANSI_COLOR="0;31"CPE_NAME="cpe:/o:centos:centos:7"HOME_URL=";BUG_REPORT_URL=";CENTOS_MANTISBT_PROJECT="CentOS-7"CENTOS_MANTISBT_PROJECT_VERSION="7"REDHAT_SUPPORT_PRODUCT="centos"REDHAT_SUPPORT_PRODUCT_VERSION="7"

安装步骤,请无脑食用

安装yum install -y yum-utilsyum-config-manager --add-repo  install -y docker-ce docker-ce-cli containerd.io镜像加速器sudo mkdir -p /etc/dockersudo tee /etc/docker/daemon.json <<-'EOF'{  "registry-mirrors": [";]}EOFsudo systemctl daemon-reloadsudo systemctl restart docker

出这玩意就算成功了

[root@localhost ~]# docker versionClient: Docker Engine - Community Version:           20.10.5 API version:       1.41 Go version:        go1.13.15 Git commit:        55c4c88 Built:             Tue Mar  2 20:33:55 2021 OS/Arch:           linux/amd64 Context:           default Experimental:      trueServer: Docker Engine - Community Engine:  Version:          20.10.5  API version:      1.41 (minimum version 1.12)  Go version:       go1.13.15  Git commit:       363e9a8  Built:            Tue Mar  2 20:32:17 2021  OS/Arch:          linux/amd64  Experimental:     false containerd:  Version:          1.4.3  GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b runc:  Version:          1.0.0-rc92  GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff docker-init:  Version:          0.19.0  GitCommit:        de40ad0

你可以安装一个hello-world来试试

[root@localhost ~]# docker run hello-worldUnable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-world2db29710123e: Pull completeDigest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60fStatus: Downloaded newer image for hello-world:latestHello from Docker!This message shows that your installation appears to be working correctly.To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.    (amd64) 3. The Docker daemon created a new container from that image which runs the    executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it    to your terminal.To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bashShare images, automate workflows, and more with a free Docker ID:  more examples and ideas, visit: 

底层原理

docker是一个Client-Server,Docker的守护进程运行在主机上,通过Socker从客户端访问!DockerServer接收到Docker-Client的指令,就会执行这个指令

docker为什么比vm快

docker有着比虚拟机更少的抽象层docker利用的是宿主机的内核,vm需要是Guest OS

新建一个容器的时候,docker不需要像虚拟机一样重新加载一个操作系统,避免引导。虚拟机是加载Guest OS,分钟级别的,而docker是利用宿主机的操作系统,省略了这个复杂的过程,秒级

docker容器

LXC

VM

虚拟化类型

OS虚拟化

OS虚拟化

硬件虚拟化

性能

=物理机性能

=物理机性能

5%-20%损耗

隔离性

NS隔离

NS隔离

QoS

Cgroup弱

Cgroup弱

安全性

GuestOS

只支持linux

只支持linux

全部

标签: #centos72安装docker