docker推荐单个容器运行(docker容器状态的转换实现)
类别:服务器 浏览量:2948
时间:2022-01-23 02:29:18 docker推荐单个容器运行
docker容器状态的转换实现一 docker容器状态转换图
二 实战
[root@localhost ~]# docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 3 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 993MiB Name: localhost.localdomain ID: 6ULL:CFMN:YT7C:4RXZ:2CJ4:26H2:D4Y6:YHUP:SH7L:QLEQ:AWEB:EWTB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will not be supported in future releases. WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE clearlinux latest 32685d114002 6 days ago 62.5MB busybox latest 6ad733544a63 6 days ago 1.13MB alpine latest 053cde6e8953 6 days ago 3.96MB [root@localhost ~]# docker run -d --name box1 busybox 4ca3d293206cd34e449075491679b0cddd619b451cac7a3d20d5b5daaa6095d8 [root@localhost ~]# docker run -itd --name box2 busybox 9c1578a50f0b97d48c7501dda6d6e1c3d8b3d9ed0e37416120f91f5a634fb12f [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 9c1578a50f0b busybox "sh" 13 seconds ago Up 11 seconds box2 4ca3d293206c busybox "sh" 47 seconds ago Exited (0) 45 seconds ago box1 [root@localhost ~]# docker run -itd --name box3 busybox e84a746ea040603aa4db791da77aee2e2502ff5b184e89049a74805671a58ba9 [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 5 seconds ago Up 4 seconds box3 9c1578a50f0b busybox "sh" About a minute ago Up About a minute box2 4ca3d293206c busybox "sh" 2 minutes ago Exited (0) 2 minutes ago box1 [root@localhost ~]# docker info Containers: 3 Running: 2 Paused: 0 Stopped: 1 Images: 3 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 993MiB Name: localhost.localdomain ID: 6ULL:CFMN:YT7C:4RXZ:2CJ4:26H2:D4Y6:YHUP:SH7L:QLEQ:AWEB:EWTB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will not be supported in future releases. WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 4 minutes ago Up 4 minutes box3 9c1578a50f0b busybox "sh" 6 minutes ago Up 6 minutes box2 4ca3d293206c busybox "sh" 6 minutes ago Exited (0) 6 minutes ago box1 [root@localhost ~]# docker restart 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 5 minutes ago Up 5 minutes box3 9c1578a50f0b busybox "sh" 7 minutes ago Up 2 seconds box2 4ca3d293206c busybox "sh" 8 minutes ago Exited (0) 8 minutes ago box1 [root@localhost ~]# docker pause 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 8 minutes ago Up 8 minutes box3 9c1578a50f0b busybox "sh" 10 minutes ago Up 2 minutes (Paused) box2 4ca3d293206c busybox "sh" 10 minutes ago Exited (0) 10 minutes ago box1 [root@localhost ~]# docker info Containers: 3 Running: 1 Paused: 1 Stopped: 1 Images: 3 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 993MiB Name: localhost.localdomain ID: 6ULL:CFMN:YT7C:4RXZ:2CJ4:26H2:D4Y6:YHUP:SH7L:QLEQ:AWEB:EWTB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will not be supported in future releases. WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled [root@localhost ~]# docker unpause 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 11 minutes ago Up 11 minutes box3 9c1578a50f0b busybox "sh" 13 minutes ago Up 6 minutes box2 4ca3d293206c busybox "sh" 14 minutes ago Exited (0) 14 minutes ago box1 [root@localhost ~]# docker info Containers: 3 Running: 2 Paused: 0 Stopped: 1 Images: 3 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0 runc version: 3f2f8b84a77f73d38244dd690525642a72156c64 init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-327.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 993MiB Name: localhost.localdomain ID: 6ULL:CFMN:YT7C:4RXZ:2CJ4:26H2:D4Y6:YHUP:SH7L:QLEQ:AWEB:EWTB Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false WARNING: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to enable d_type support. Running without d_type support will not be supported in future releases. WARNING: bridge-nf-call-iptables is disabled WARNING: bridge-nf-call-ip6tables is disabled [root@localhost ~]# docker kill 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 17 minutes ago Up 17 minutes box3 9c1578a50f0b busybox "sh" 19 minutes ago Exited (137) 3 seconds ago box2 4ca3d293206c busybox "sh" 20 minutes ago Exited (0) 20 minutes ago box1 [root@localhost ~]# docker stop e8 ^[[Ae8 [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 19 minutes ago Exited (137) 1 second ago box3 9c1578a50f0b busybox "sh" 21 minutes ago Exited (137) 2 minutes ago box2 4ca3d293206c busybox "sh" 22 minutes ago Exited (0) 22 minutes ago box1 [root@localhost ~]# docker start e8 e8 [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 22 minutes ago Up 5 seconds box3 9c1578a50f0b busybox "sh" 24 minutes ago Exited (137) 4 minutes ago box2 4ca3d293206c busybox "sh" 24 minutes ago Exited (0) 24 minutes ago box1 [root@localhost ~]# docker start 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 25 minutes ago Up 3 minutes box3 9c1578a50f0b busybox "sh" 27 minutes ago Up 3 seconds box2 4ca3d293206c busybox "sh" 28 minutes ago Exited (0) 28 minutes ago box1 [root@localhost ~]# docker restart 9c 9c [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES e84a746ea040 busybox "sh" 26 minutes ago Up 4 minutes box3 9c1578a50f0b busybox "sh" 28 minutes ago Up 7 seconds box2 4ca3d293206c busybox "sh" 28 minutes ago Exited (0) 28 minutes ago box1
补充知识:一张图看懂docker容器的所有状态
部分解释:
创建容器的命令
run 是create和start的结合
create-created-start
例子:
docker create httpd
OCM硬件信息
docker kill id 强制关闭容器
die某个程序别强制退出,或者进程出错
docker pause :暂停容器中所有的进程。
docker unpause :恢复容器中所有的进程。
以上这篇docker容器状态的转换实现就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持开心学习网。
您可能感兴趣
- docker部署oracle(Docker安装Oracle_11g的方法)
- docker开源软件(5款超好用的开源 Docker工具强烈推荐)
- docker和jenkins自动化(Docker使用Git实现Jenkins发布、测试项目的详细流程)
- docker容器是怎么进行通信的(Docker容器间通信与外网通信的操作)
- docker10个小技巧(docker比赛提交常用命令小结)
- docker-compose绑定端口失效(docker-compose创建网桥,添加子网,删除网卡的实现)
- docker ip地址分配(docker添加网桥并设置ip地址范围操作)
- dockernginx服务器教程(Docker镜像+nginx 部署 vue 项目的方法)
- dockercp用法详解(Docker开启TLS和CA认证的方法步骤)
- docker desktop怎么安装共识容器(安装Docker Desktop报错WSL 2 installation is incomplete的问题解决报错)
- docker怎么做数据(Docker数据卷常用操作代码实例)
- docker网络有哪些模式(Docker网络原理及自定义网络详细解析)
- docker端口映射怎么添加(Docker 动态修改容器端口映射的方法)
- docker阿里云服务器教程(Docker安装阿里云服务器和在虚拟机安装遇到的坑问题小结)
- docker打包配置好的镜像(docker镜像的导入和导出的实现)
- docker和tomcat建立连接(如何基于Dockerfile构建tomcat镜像)
- 超撩人治愈的绝美水彩,原来出自她之手 一笔一画令无数人沉醉(超撩人治愈的绝美水彩)
- 新手的勾线(新手的勾线)
- ()
- 书法欣赏 宋.志南诗《绝句》(宋.志南诗绝句)
- 每周一首古诗 《绝句》(每周一首古诗绝句)
- 蓝色代表什么(蓝色代表什么性格的人)
热门推荐
- thinkphp框架切换数据库(ThinkPHP3.2.3框架实现执行原生SQL语句的方法示例)
- thinkphp6.0安装(使用composer安装使用thinkphp6.0框架问题视频教程)
- sqlserver语句创建窗口布局(SQL Server 2012 开窗函数)
- apache安全配置(apache在win2003下的安全设置配合文件夹权限目录,很好很安全)
- 最新版MySQL 8.0.22下载安装超详细教程(Windows 64位)(最新版MySQL 8.0.22下载安装超详细教程Windows 64位)
- mysql如何删除整个表及数据(Mysql删除数据以及数据表的方法实例)
- js 出现cannot find function(Fatal error: Call to a member function read on a non-object in 错误解决方法)
- windows 10中如何安装numpy(windows下numpy下载与安装图文教程)
- python的turtle库怎么进入(python的turtle库使用详解)
- sql中trim函数用法(SQL中Truncate的用法)
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9