首页 > 其他 > 详细

docker学习总结四

时间:2018-12-06 23:13:31      阅读:178      评论:0      收藏:0      [点我收藏+]
1. 创建容器

$ docker create -it ubuntu:latest
2. 启动容器
$ docker start 容器ID
3. 新建并启动容器
$ docker run -it ubuntu:16.04 /bin/bash
4. 守护态运行
$ docker run -d ubuntu /bin/sh -c "while true; do echo hello world; sleep 1; done"
5.停止容器
$ docker stop 容器id
6. 进入容器
$ docker exec -it 容器id /bin/bash
7. 删除容器
删除已经终止的容器
$ docker rm 容器id

删除正在运行的容器
$ docker run -d ubuntu:16.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"
8. 导出容器
不管运行与否都可导出
$ docker export -o test_for_run.tar 容器id

$ docker export 容器id >test_for_stop.tar
9. 导入容器
$ docker import test_for_run.tar - test/ubuntu:dao.1

docker学习总结四

原文:http://blog.51cto.com/13670314/2327290

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!