Docker容器管理

2016-12-14 14:42:00
村里来的扫地僧
原创
1893

如何查看启动的容器:


[root@localhost home]# docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
912e33de00e5        centos              "/bin/bash"         10 minutes ago      Up 10 minutes                           sick_euclid         
3b579da4b40f        centos3             "/bin/bash"         27 minutes ago      Up 27 minutes                           agitated_wilson     
c90bb04f096d        5a7df8dd4d20        "/bin/bash"         23 hours ago        Up 23 hours                             happy_fermi         
[root@localhost home]# 
进入容器:



[root@localhost home]# docker run -it centos /bin/bash 
[root@db5c9229c3fa /]# cat /etc/issue
CentOS release 6.7 (Final)
Kernel r on an m
查看内核:



[root@db5c9229c3fa /]# uname -a
Linux db5c9229c3fa 2.6.32-573.18.1.el6.x86_64 #1 SMP Tue Feb 9 22:46:17 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@db5c9229c3fa /]# 
一直让系统启动着:



[root@localhost home]# docker start 807db1718ddd
Docker启动在后台:



[root@localhost home]# docker run -itd centos2 /bin/bash 
54fdcc0308bdde7c6a8ca725d396a1b49b479cecd954424e62b739b260ae799a
[root@localhost home]# 
停止某一个容器:



[root@localhost home]# docker stop [CONTAINER ID]
如何删除一个容器:



[root@localhost ~]# docker rm -f   [CONTAINER ID]
发表评论
叁 减 柒 =
评论通过审核后显示。