[root@lixian home]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fe1ec605fb7f cetos7-ls "bin/bash" 14 minutes ago Up 14 minutes 0.0.0.0:80->80/tcp Centos7
7.进入容器
[root@lixian home]# docker exec -it fe bash
[root@fe1ec605fb7f /]# ls
bin dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
#打包镜像之前已经安装过nginx服务,现在在容器内启动一下
#容器内的操作系统和本地的操作系统是分离的
[root@fe1ec605fb7f /]# /usr/sbin/nginx
[root@fe1ec605fb7f /]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 210/nginx: master p
tcp6 0 0 :::80 :::* LISTEN 210/nginx: master p