Docker中使用CentOS7镜像
因后面会将操作系统从CentOS6.4升级到CentOS7,先试用下CentOS7。
- 启动容器服务
systemctl start docker.service
- 下载CentOS7 镜像
-
root@wxtest1607 ~]# docker pull centos:7.2.1511
-
[root@wxtest1607 lixr]# docker images
-
REPOSITORY TAG IMAGE ID CREATED SIZE
-
centos 7.2.1511 686672a1d0cc 7 weeks ago 194.6 MB
-
- 登录docker中的CentOS7
-
docker run -ti 6866 /bin/bash
-
#6866 是 IMAGE ID 前四位数字-能区分出是哪个image即可
-
root@b4ad1d1c87da /]#
-
#登录成功,接下来就可以为所欲为啦。
-
- 检查CentOS7系统
-
root@b4ad1d1c87da /]# uname -a
-
Linux b4ad1d1c87da 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
-
-
-
- 退出后 再进入CentOS7
-
[root@wxtest1607 ~]# docker ps -a
-
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
-
b4ad1d1c87da 6866 "/bin/bash" 12 seconds ago Up 9 seconds mad_swanson
-
drunk_hypatia
-
[root@wxtest1607 ~]# docker exec -ti b4ad /bin/bash
-
[root@b4ad1d1c87da /]#
-