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!

The reason for using Docker is that it provides an efficient, portable and consistent environment to package, distribute, and run applications. 1) Docker is a containerized platform that allows developers to package applications and their dependencies into lightweight, portable containers. 2) It is based on Linux container technology and joint file system to ensure fast startup and efficient operation. 3) Docker supports multi-stage construction, optimizes image size and deployment speed. 4) Using Docker can simplify development and deployment processes, improve efficiency and ensure consistency across environments.

Docker's application scenarios in actual projects include simplifying deployment, managing multi-container applications and performance optimization. 1.Docker simplifies application deployment, such as using Dockerfile to deploy Node.js applications. 2. DockerCompose manages multi-container applications, such as web and database services in microservice architecture. 3. Performance optimization uses multi-stage construction to reduce the image size and monitor the container status through health checks.

Select Docker in a small project or development environment, and Kubernetes in a large project or production environment. 1.Docker is suitable for rapid iteration and testing, 2. Kubernetes provides powerful container orchestration capabilities, suitable for managing and expanding large applications.

Docker is important on Linux because Linux is its native platform that provides rich tools and community support. 1. Install Docker: Use sudoapt-getupdate and sudoapt-getinstalldocker-cedocker-ce-clicotainerd.io. 2. Create and manage containers: Use dockerrun commands, such as dockerrun-d--namemynginx-p80:80nginx. 3. Write Dockerfile: Optimize the image size and use multi-stage construction. 4. Optimization and debugging: Use dockerlogs and dockerex

Docker is a containerization tool, and Kubernetes is a container orchestration tool. 1. Docker packages applications and their dependencies into containers that can run in any Docker-enabled environment. 2. Kubernetes manages these containers, implementing automated deployment, scaling and management, and making applications run efficiently.

The purpose of Docker is to simplify application deployment and ensure that applications run consistently in different environments through containerization technology. 1) Docker solves the environmental differences problem by packaging applications and dependencies into containers. 2) Create images using Dockerfile to ensure that the application runs consistently anywhere. 3) Docker's working principle is based on images and containers, and uses the namespace and control groups of the Linux kernel to achieve isolation and resource management. 4) The basic usage includes pulling and running images from DockerHub, and the advanced usage involves managing multi-container applications using DockerCompose. 5) Common errors such as image building failure and container failure to start, you can debug through logs and network configuration. 6) Performance optimization construction

The methods of installing and using Docker on Ubuntu, CentOS, and Debian are different. 1) Ubuntu: Use the apt package manager, the command is sudoapt-getupdate&&sudoapt-getinstalldocker.io. 2) CentOS: Use the yum package manager and you need to add the Docker repository. The command is sudoyumininstall-yyum-utils&&sudoyum-config-manager--add-repohttps://download.docker.com/lin

Using Docker on Linux can improve development efficiency and simplify application deployment. 1) Pull Ubuntu image: dockerpullubuntu. 2) Run Ubuntu container: dockerrun-itubuntu/bin/bash. 3) Create Dockerfile containing nginx: FROMubuntu;RUNapt-getupdate&&apt-getinstall-ynginx;EXPOSE80. 4) Build the image: dockerbuild-tmy-nginx. 5) Run container: dockerrun-d-p8080:80


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

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

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

SublimeText3 Linux new version
SublimeText3 Linux latest version

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),

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
