Docker学习
官方文档:Install Docker Engine on CentOS | Docker Documentation
安装
#1、卸载旧版本yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine#2、需要的安装包yum install -y yum-utils#3、设置镜像的仓库,镜像源建议替换为阿里云的yum-config-manager \--add-repo \https://download.docker.com/linux/centos/docker-ce.repo#默认是国外的yum-config-manager \--add-repo \http:mirrors.aliyum.com/docker-ce/linux/contos/docker-re.repo#更新yum软件包索引yum makecache fast#4、安装docker的相关版本,docker-ce社区版 ee企业版yum install docker-ce docker-ce-cli containerd.io#5、启动dockersystemctl start docker#6、使用docker version 检查是否启动成功[root@docker-study ~]# docker versionClient: Docker Engine - CommunityVersion: 20.10.12API version: 1.41Go version: go1.16.12Git commit: e91ed57Built: Mon Dec 13 11:45:41 2021OS/Arch: linux/amd64Context: defaultExperimental: trueServer: Docker Engine - CommunityEngine:Version: 20.10.12API version: 1.41 (minimum version 1.12)Go version: go1.16.12Git commit: 459d0dfBuilt: Mon Dec 13 11:44:05 2021OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.4.12GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5drunc:Version: 1.0.2GitCommit: v1.0.2-0-g52b36a2docker-init:Version: 0.19.0GitCommit: de40ad0#运行镜像测试[root@docker-study ~]# docker run hello-worldHello 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 theexecutable that produces the output you are currently reading.4. The Docker daemon streamed that output to the Docker client, which sent itto 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:https://hub.docker.com/For more examples and ideas, visit:https://docs.docker.com/get-started/#查看镜像[root@docker-study ~]# docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEhello-world latest feb5d9fea6a5 4 months ago 13.3kB
