#####1. 查询CentOS的发行编号 ```shell [root@Test100 /]# uname -r 3.10.0-693.el7.x86_64 ``` #####2. 下载Docker ```shell [root@Test100 Downloads]# yum -y install docker-io ``` #####3. 启动Docker ```shell [root@Test100 Downloads]# service docker start Redirecting to /bin/systemctl start docker.service ``` #####4. 拉取最新CentOS镜像 ```shell [root@Test100 Downloads]# docker pull centos:7.5.1804 Trying to pull repository docker.io/library/centos ... 7.5.1804: Pulling from docker.io/library/centos 7dc0dca2b151: Pull complete Digest: sha256:91236f16c37dc70e7ae88a7f0c849041da5d500212337600dcda8878da21326e Status: Downloaded newer image for docker.io/centos:7.5.1804 ``` #####5. 查询Docker镜像ID ```shell [root@Test100 Downloads]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/centos 7.5.1804 49f7960eb7e4 3 weeks ago 200 MB ``` #####6. 登录docker中的CentOS7 ```shell [root@Test100 Downloads]# docker run -ti 49f7 /bin/bash #49f7是 IMAGE ID 前四位数字-能区分出是哪个image即可 [root@761219d2db71 /]# #登录成功,接下来就可以为所欲为啦。 ``` #####7. 检查CentOS7系统 ```shell [root@761219d2db71 /]# uname -a Linux 761219d2db71 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux [root@761219d2db71 /]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) ``` #####8. 退出后 再进入CentOS7 ```shell Ctrl + P + Q #退出容器但是不关闭 [root@Test100 Downloads]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 761219d2db71 49f7 "/bin/bash" 27 minutes ago Exited (127) 56 seconds ago nifty_panini [root@Test100 Downloads]# docker exec -ti 7612 /bin/bash ``` 最后修改:2018 年 07 月 07 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏