时间:2020-03-06来源:电脑系统城作者:电脑系统城
1、docker客户端
1)通过docker查看客户端的所有命令
[root@localhost ~]# docker
2)深入了解docker命令使用方法
[root@localhost%20~]#%20docker%20stats%20--help
2、容器的使用
1)获取镜像(载入ubuntu镜像)
[root@localhost%20~]#%20docker%20pull%20ubuntu
2)启动容器,并进入该容器
[root@localhost%20~]#%20docker%20run%20-it%20ubuntu%20/bin/bash
参数说明:
-i:交互式操作
-t:终端
ubuntu:ubuntu镜像
/bin/bash:放在镜像名后的是命令,这里我们希望有一个交互式的Shell,因此用的是/bin/bash
退出终端使用exit命令
3)查看所有容器
[root@localhost%20~]#%20docker%20ps%20-a
4)启动已经停止的容器
[root@localhost%20~]#%20docker%20start%2016f91abb561d
5)docker容器后台运行,使用-d指定容器的运行模式
[root@localhost%20~]#%20docker%20run%20-itd%20--name%20ubuntu-test%20ubuntu%20/bin/bash
6)停止容器
[root@localhost%20~]#%20docker%20stop%20cbeab6605102
7)重启容器
[root@localhost%20~]#%20docker%20restart%20cbeab6605102
8)后台启动时进入容器时,使用attach命令
[root@localhost%20~]#%20docker%20attach%20f4c1ed1987e4
注意:使用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)
2023-03-17
Nginx主机域名配置实现2023-03-17
Nginx配置-日志格式配置方式2023-03-17
Apache APISIX Dashboard 未授权访问漏洞分析(CVE-2021-45232)正常项目无法访问(Linux 服务器),启动tomcat时卡在下图位置,项目无法启动。1、先检查tomcat日志、项目日志没有报错信息,且没再产生新的日志信息。2、jdk、tomcat 、 jvm 配置,服...
2023-03-15
这篇文章主要介绍了Kubernetes中Nginx服务启动失败排查流程(Error: ImagePullBackOff),本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以...
2023-03-15