docker学习总结四
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker学习总结四相关的知识,希望对你有一定的参考价值。
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学习总结四的主要内容,如果未能解决你的问题,请参考以下文章
Docker学习总结(59)——DockerFIile相关知识点再总结