There are 7 types of container status: 1. "created", which means it has been created; 2. "restarting", which means it is restarting; 3. "running", which means it is running; 4. "removing", which means it is migrating. Medium; 5. "paused" means paused state; 6. "exited" means stopped, etc.
The operating environment of this tutorial: linux5.9.8 system, docker-1.13.1 version, Dell G3 computer.
Seven states of Docker containers
View the status of all containers under docker:
docker ps -a
Returned content , one field is STATUS.
STATUS: Container status, there are 7 types:
created(已创建) restarting(重启中) running(运行中) removing(迁移中) paused(暂停) exited(停止) dead(死亡)
Among these statuses, the most important and common ones are other than restarting (restarting) and removing (migrating) Five states. Basically, most container life cycle diagrams on the Internet only contain five states: created, running, paused, exited, and dead.
The most common one, when a container becomes exited
for some reason, you can use start
to restart, for example: when running When, it prompts that the container is not running, and the container is not displayed when using docker ps
Later, I want to create a new container and find that It prompts that the containers created before are actually still there. Use docker ps -a
to view all containers and see: They are actually in the exited
state
Subsequently, I used docker start OCR
to restart the container and checked that everything inside was still there.
Similar to exited (stopped)
UP is still running (running)
In addition, if you want to know these statuses, the easiest way is, docker --help
, and in the returned information, you can see:
# 用来创建容器 create Create a new container # 在一个运行状态的容器中执行命令 exec Run a command in a running container # 杀死运行中的容器 kill Kill one or more running containers # 让容器暂停 pause Pause all processes within one or more containers # 恢复容器 unpause Unpause all processes within one or more containers # 重启容器 restart Restart one or more containers # 新建并初始化一个容器(注意 是一个新的容器) run Run a command in a new container # 启动一个被停止的容器 start Start one or more stopped containers # 暂停运行中的容器 stop Stop one or more running containers
Extended knowledge: container life cycle
You can Google container lifecycle to see related content, mainly search for pictures, you can see that there are many pictures, just like the life of the process The cycle is the same.
Mainly reflects the changing relationship between the five states of created (created), running (running), paused (paused), exited (stopped), and dead (dead).
The started in the figure below is approximately equal to running.
The stopped in the picture below is approximately equal to exited
## Source: Docker Container Lifecycle Management: Create, Run, Pause, Stop And Delete
From: docker basic commands
From: docker command map
From :Docker Series 03—Docker Basics Introduction
In fact, the above picture should originally come from:
From: Docker Internals-A Deep pe Into Docker For Engineers Interested In The Gritty Details.
- Docker Container Lifecycle Management: Create, Run, Pause, Stop And Delete
- Introduction to the Docker Life Cycle Chinese translation of this article:
- Zhihu article: Introduction to Docker life cycle
- Zhihu article: Docker life cycle
docker video tutorial"
The above is the detailed content of What are the statuses of docker containers?. For more information, please follow other related articles on the PHP Chinese website!

docker中rm和rmi的区别:rm命令用于删除一个或者多个容器,而rmi命令用于删除一个或者多个镜像;rm命令的语法为“docker rm [OPTIONS] CONTAINER [CONTAINER...]”,rmi命令的语法为“docker rmi [OPTIONS] IMAGE [IMAGE...]”。

docker官方镜像有:1、nginx,一个高性能的HTTP和反向代理服务;2、alpine,一个面向安全应用的轻量级Linux发行版;3、busybox,一个集成了三百多个常用Linux命令和工具的软件;4、ubuntu;5、PHP等等。

docker容器重启后数据会丢失的;但是可以利用volume或者“data container”来实现数据持久化,在容器关闭之后可以利用“-v”或者“–volumes-from”重新使用以前的数据,docker也可挂载宿主机磁盘目录,用来永久存储数据。

docker对于小型企业、个人、教育和非商业开源项目来说是免费的;2021年8月31日,docker宣布“Docker Desktop”将转变“Docker Personal”,将只免费提供给小型企业、个人、教育和非商业开源项目使用,对于其他用例则需要付费订阅。

docker能安装oracle。安装方法:1、拉取Oracle官方镜像,可以利用“docker images”查看镜像;2、启动容器后利用“docker exec -it oracle11g bash”进入容器,并且编辑环境变量;3、利用“sqlplus /nolog”进入oracle命令行即可。

解决方法:1、停止docker服务后,利用“rsync -avz /var/lib/docker 大磁盘目录/docker/lib/”将docker迁移到大容量磁盘中;2、编辑“/etc/docker/daemon.json”添加指定参数,将docker的目录迁移绑定;3、重载和重启docker服务即可。

AUFS是docker最早支持的存储引擎。AUFS是一种Union File System,是文件级的存储驱动,是Docker早期用的存储驱动,是Docker18.06版本之前,Ubuntu14.04版本前推荐的,支持xfs、ext4文件。

容器管理ui工具有:1、Portainer,是一个轻量级的基于Web的Docker管理GUI;2、Kitematic,是一个GUI工具,可以更快速、更简单的运行容器;3、LazyDocker,基于终端的一个可视化查询工具;4、DockStation,一款桌面应用程序;5、Docker Desktop,能为Docker设置资源限制,比如内存,CPU,磁盘镜像大小;6、Docui。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools
