socker(docker安装)

精英怪
广告

docker名词

socker(docker安装)

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

容器(container)docker利用容器技术,独立运行一个或者一个组应用,通过镜像来创建的启动,停止,删除,基本命令目前就可以吧这个容器理解为一个简易的linux系统仓库(repository)仓库就是存放镜像的地方仓库分为公有仓库和私有仓库

看一下配置以供参考

[root@localhost ~]# uname -r 3.10.0-514.el7.x86_64 [root@localhost ~]# cat /etc/os-release NAME="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="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

安装步骤,请无脑食用

安装 yum install -y yum-utils yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install -y docker-ce docker-ce-cli containerd.io 镜像加速器 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://7g7v2p8w.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker

出这玩意就算成功了

[root@localhost ~]# docker version Client: 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: true Server: 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-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 2db29710123e: Pull complete Digest: sha256:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f Status: Downloaded newer image for hello-world:latest Hello 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 bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/

底层原理

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

全部

发表评论

快捷回复: 表情:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog
评论列表 (暂无评论,164人围观)

还没有评论,来说两句吧...