码迷,mamicode.com
首页 > 其他好文 > 详细

docker cmd line

时间:2014-05-26 14:38:52      阅读:421      评论:0      收藏:0      [点我收藏+]

标签:c   class   code   tar   a   int   

$ ID=$(sudo docker run -d ubuntu /usr/bin/top -b)
$ sudo docker attach $ID

在容器中运行top命令。如果attach 的时候就能看到top的是输出。

$ sudo docker stop $ID 就能结束这个容器。

docker build PATH 比如 `.` 会把当前目录的文件送给守护进程。

cp

Copy files/folders from the containers filesystem to the host path. Paths are relative to the root of the filesystem.

Usage: docker cp CONTAINER:PATH HOSTPATH


记录守护进程的事件

Shell 1: Listening for events:

$ sudo docker events

Shell 2: Start and Stop a Container:

$ sudo docker start 4386fb97867d
$ sudo docker stop 4386fb97867d

Shell 1: (Again .. now showing events):

[2013-09-0315:49:26+0200 CEST]4386fb97867d:(from12de384bfb10) start
[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10)die[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10) stop

Show events in the past from a specified time:

$ sudo docker events --since 1378216169[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10)die[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10) stop

$ sudo docker events --since ‘2013-09-03‘[2013-09-0315:49:26+0200 CEST]4386fb97867d:(from12de384bfb10) start
[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10)die[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10) stop

$ sudo docker events --since ‘2013-09-03 15:49:29 +0200 CEST‘[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10)die[2013-09-0315:49:29+0200 CEST]4386fb97867d:(from12de384bfb10) stop
 

Docker 和 UFW

Dockers是用桥接的方式管理容器的网络,默认情况下,如果你安装了UFW防火墙,他会过滤掉所有的转发,所以你需要允许UFW转发

sudo nano /etc/default/ufw
----
# Change:
# DEFAULT_FORWARD_POLICY="DROP"
# to
DEFAULT_FORWARD_POLICY="ACCEPT"

docker cmd line,布布扣,bubuko.com

docker cmd line

标签:c   class   code   tar   a   int   

原文地址:http://www.cnblogs.com/ggaaooppeennngg/p/3746401.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!