docker容器使用(docker容器命令)
1、docker客户端
1)通过docker查看客户端的所有命令
[root@localhost ~]# docker
2)深入了解docker命令使用方法
[root@localhost ~]# docker stats --help
2、容器的使用
1)获取镜像(载入ubuntu镜像)
[root@localhost ~]# docker pull ubuntu
2)启动容器,并进入该容器
[root@localhost ~]# docker run -it ubuntu /bin/bash
参数说明:
-i:交互式操作
-t:终端
ubuntu:ubuntu镜像
/bin/bash:放在镜像名后的是命令,这里我们希望有一个交互式的Shell,因此用的是/bin/bash
退出终端使用exit命令
3)查看所有容器
[root@localhost ~]# docker ps -a
4)启动已经停止的容器
[root@localhost ~]# docker start 16f91abb561d
5)docker容器后台运行,使用-d指定容器的运行模式
[root@localhost ~]# docker run -itd --name ubuntu-test ubuntu /bin/bash
6)停止容器
[root@localhost ~]# docker stop cbeab6605102
7)重启容器
[root@localhost ~]# docker restart cbeab6605102
8)后台启动时进入容器时,使用attach命令
[root@localhost ~]# docker attach f4c1ed1987e4
注意:使用attach进入容器后,再退出这个容器,会导致容器的停止
9)使用exec进入后台运行的容器,从容器中退出,不会导致容器的停止
[root@localhost ~]# docker exec -it d9d6240dffe1 /bin/bash
3、容器的导入导出
1)导出容器
[root@localhost ~]# docker export d9d6240dffe1 > /tmp/ubuntu.tar
2)导入容器快照(从快照文件中导入为镜像,以下实例将快照文件ubuntu.tar导入到镜像test/ubuntu:v1)
[root@localhost ~]# docker import /tmp/ubuntu.tar test/ubuntu:v1
4、删除容器
1)删除一个容器
[root@localhost ~]# docker rm -f d9d6240dffe1
2)删除所有容器
[root@localhost ~]# docker rm -f $(docker ps -aq)
每一份赞赏源于懂得
赞赏
0人进行了赞赏支持
0
收藏
Allbet Gaming声明:该文看法仅代表作者自己,与www.allbetgame.us无关。转载请注明:鹤岗一中:docker容器使用(docker容器命令)Sunbet www.4008981981.com Sunbet(www.sunbet.red)是进入Sunbet亚太地区站点。Sunbet开放Sunbet会员开户网址、Sunbet代理开户、Sunbet手机版下载、Sunbet电脑客户端下载等业务。
皇冠新现金网是一个开放皇冠体育代理最新登录线路、皇冠体育会员最新登录线路、皇冠代理APP下载、皇冠会员APP下载、皇冠线路APP下载、皇冠电脑版下载、皇冠手机版的平台。皇冠体育APP上登录线路最新、新2皇冠网址更新最快,皇冠体育APP开放皇冠会员注册、皇冠代理开户等业务。这个故事线比较完整
欢迎进入欧博官网(Allbet Game):www.aLLbetgame.us,欧博官网是欧博集团的官方网站。欧博官网开放Allbet注册、Allbe代理、Allbet电脑客户端、Allbet手机版下载等业务。好嗨呦,放假看贼爽