wm88990

Docker中使用CentOS7镜像
1. 查询CentOS的发行编号 [root@Test100 /]# uname -r 3.10.0-693.el...
扫描右侧二维码阅读全文
02
2018/07

Docker中使用CentOS7镜像

1. 查询CentOS的发行编号
[root@Test100 /]# uname -r
3.10.0-693.el7.x86_64
2. 下载Docker
[root@Test100 Downloads]#  yum -y install docker-io
3. 启动Docker
[root@Test100 Downloads]# service docker start
Redirecting to /bin/systemctl start docker.service
4. 拉取最新CentOS镜像
[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
[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
[root@Test100 Downloads]# docker run -ti 49f7 /bin/bash
#49f7是 IMAGE ID 前四位数字-能区分出是哪个image即可
[root@761219d2db71 /]#
#登录成功,接下来就可以为所欲为啦。
7. 检查CentOS7系统
[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
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 日 07 : 29 PM
如果觉得我的文章对你有用,请随意赞赏

发表评论