容器created状态_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容器状态的转换实现就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
容器created状态_docker容器状态的转换实现相关推荐
- 容器处于restarting状态_Docker容器操作-基础命令
docker container run 该命令用于启动新容器,该命令的最简单的形式是接收镜像和命令作为参数.镜像用于创建容器,而命令则是希望容器运行的应用. $ docker container r ...
- docker 容器启动顺序_Docker容器启动时初始化Mysql数据库
1. 前言 Docker在开发中使用的越来越多了,最近搞了一个Spring Boot应用,为了方便部署将Mysql也放在Docker中运行.那么怎么初始化 SQL脚本以及数据呢? 我这里有两个传统方案 ...
- “迁移策略+新容器运行时”应对有状态应用的冷热迁移挑战
戳蓝字"CSDN云计算"关注我们哦! 作者:稻农 来源:阿里系统软件技术 稻农(叶磊) 阿里云智能事业群高级技术专家 参与主导容器运行时及网络创新工作:目前的工作侧重于基于进程虚拟 ...
- docker容器虚拟化技术_Docker,虚拟机和容器的全面介绍
docker容器虚拟化技术 by shota jolbordi 通过Shota Jolbordi Docker has been a buzzword for tech people for the ...
- ping 不通容器 宿主_Docker容器间通信
Docker容器间通信 Docker会为每个创建的容器自动分配一个虚拟IP,这个虚拟IP无法从容器外侧进行访问,只是Docker环境内部容器间彼此通信的标识,容器间的网络是互通互联的. 但是通过这种虚 ...
- docker删除none镜像_Docker容器相关命令
1.新建并启动容器 使用以下docker run命令即可新建并启动一个容器,该命令是最常用的命令,它有很多选项,下面将列举一些常用的选项. -d选项:表示后台运行 -P选项:随机端口映射 -p选项:指 ...
- day91~93-Paas云平台_docker容器
学习目标 能够说出docker容器和虚拟机的主要区别 能够说出docker用到的内核技术 能够安装docker 掌握镜像的常见操作 掌握镜像仓库的搭建与使用 掌握常见的容器操作命令 能够查找docke ...
- docker 内部ping不通宿主机_Docker容器数据管理
在Docker容器内部创建的文件默认存储在可写的容器层,容易产生几个问题: 当容器不存在时,数据文件不能持久化,同时这些数据文件不方便在容器之外被其他进程使用. 当容器运行的时候容器可写层严重依赖宿主 ...
- docker 进入容器命令_Docker容器常用命令分享,赶紧收藏
1. docker run 创建一个新的容器并运行一个命令 用法:docker run [OPTIONS] IMAGE [COMMAND] [ARG-] 1.1.创建一个新的容器并运行一个命令 1.2 ...
最新文章
- MySQL查询随机数据的4种方法和性能对比
- POI Excel 如何插入新的行?
- 卡地亚搜索引擎_「AF厂卡地亚猎豹」网站SEO优化新方向
- java 动态增加控件_在ngIf中动态添加组件
- python使用手册-python(自用手册)
- c语言自学技巧,轻松学C语言,教给你学习技巧
- 部门选择控件源代码公布
- python指针引用的区别_C++基础:指针和引用的区别
- 设计模式 建造者模式_设计模式:建造者
- Linux 命令行通配符及转义符的实现
- LeetCode 434. 字符串中的单词数
- 倾听用户呼吁Skype决定开源
- nlu 意图识别_在NLU中,您无视危险的意图
- 调用网易云api接口
- 清明上河图对计算机技术的启发,吴良镛院士:《清明上河图》启示的城市方向...
- 机器学习案例实战:Python文本数据分析新闻分类任务
- 自然语言处理3 -- 词性标注
- 自然语言处理nlp全领域综述
- linux解压时,z x v f分别代表什么意思
- body 没有被撑开_为什么父div没有被撑开
热门文章
- Spring-Boot + AOP实现多数据源动态切换
- iOS端(腾讯Bugly)闪退异常上报扑获日志集成与使用指南
- 【swift学习笔记】三.使用xib自定义UITableViewCell
- Python学习笔记7:函数对象及函数对象作參数
- python为类定义构造函数
- 【转】【天道酬勤】 腾讯、百度、网易游戏、华为Offer及笔经面经
- 熊猫tv新功能介绍_您应该知道的4种熊猫绘图功能
- 走出囚徒困境的方法_囚徒困境的一种计算方法
- leetcode 316. 去除重复字母(单调栈)
- css 动画使用_如何在CSS中使用动画