Docker入门讲解

1:容器重命名
[root@Docker ~]#docker run --name test_container -i -t centos /bin/bash
[root@3ba67c6cf3f8 /]# hostname
3ba67c6cf3f8
参数解析:
“--name”:定义新建容器的名字;
2:启动,重启,停止容器
[root@Docker ~]#docker start test_container/3ba67c6cf3f8
[root@Docker ~]#docker stop test_container/3ba67c6cf3f8
[root@Docker ~]#docker restart test_container/3ba67c6cf3f8
3.创建守护式容器
[root@Docker ~]#docker run --name deamon_dave -d centos /bin/bash "while true;do echo hello world; sleep 1; done"
4:查看日志(常用的格式)
[root@Docker ~]#docker logs --tail 10 -ft deamon_dave ("-t":表示加时间戳)
实例:
[root@Docker ~]#docker logs --tail 2 -ft nodejs
2015-06-26T02:15:21.520546751Z GET /LD_Process/plugins/process/table/Table_TableOutput.xml 304 1ms
2015-06-26T02:15:21.530719515Z GET /LD_Process/plugins/process/table/Table_TableOutput.xml 304 1ms
5:在容器内部运行进程
[root@Docker ~]#docker start -ti test_container /bin/bash
[root@Docker ~]#docker exec -d test_container touch /etc/new_config_file
6:查看容器的具体信息
[root@Docker ~]#docker inspect test_container

 

转载于:https://www.cnblogs.com/qlwang/p/9051828.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值