How to delete the container created in Docker

How to delete the container created in Docker

How to delete the container created in Docker

1. First, use the docker -s -a command to list all containers

# docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f2582758af13 ubuntu "/bin/bash" 2 hours ago Up 2 hours first_ubuntu
6b5b5a969241 centos "/bin/bash" 2 days ago Exited (0) 24 hours ago ubuntu-web

2. Then use the docker stop command to stop the container to be deleted

docker stop <CONTAINER ID|NAME>

3. Now remove single or multiple containers using the following command.

docker rm <CONTAINER ID|NAME> <CONTAINER ID|NAME>

Note: You can also use the following command to remove all stopped containers at once.

docker rm $(docker ps -a -q)

Content extension:

If your docker-registry is in a container, you cannot use commands to delete the image and can only delete the image file manually. If not, you can use docker rmi image name to delete it

Docker is a platform for developers and system administrators to develop, migrate, and run applications. After the application is packaged into a Docker Image through Docker, it can be downloaded, started, expanded, deleted, and migrated in a unified way, which facilitates the deployment and operation and maintenance of the application.

Docker uses a server/client model.

The Docker client creates, runs, or deploys Docker containers by interacting with the Docker Daemon. Users can install the Docker client and Docker Daemon on the same system or on different systems. The Docker client communicates with the Docker Daemon through ports or RESTful APIs. Docker internally consists of three parts: Docker images: A Docker image is a read-only template used to create a Docker container. The image can contain a Linux operating system, Apache or a Web application, etc. Users can download already created Docker images or create Docker images for other users. Each image is composed of many layers, and Docker binds these layers into one image through Union File Systems. Each image is based on a primary image, and then new layers are added to these primary images through operation instructions. Operation instructions can be commands to run, files or directories to add, or create a usable operating environment. These operation instructions are saved in the "Dockerfile" file.

Docker registries: Docker registries are used to store Docker images, which are also divided into public and private types. The public Docker registry is Docker Hub. Users can also create private Docker registries to provide Docker images for other users to download. Docker containers: Similar to directories that store VMware virtual machine configuration files, they provide everything needed to run an application. Docker Containers can be run, started, stopped, or deleted, and each container is an isolated and secure application platform.

This is the end of this article about how to delete the container created in docker. For more information about how to delete the container created in docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solution to the Docker container cannot be stopped and deleted
  • Docker stop stops/remove deletes all containers
  • Summary of methods for creating, listing, and deleting Docker containers on Linux
  • Docker learning notes: How to view, start, terminate and delete containers
  • Docker Tips: Deleting Docker Containers and Images
  • Solution to the problem that Docker cannot stop or delete container services

<<:  MySQL 8.0.18 installation and configuration method graphic tutorial under win10 (windows version)

>>:  The easiest way to create a new user and grant permissions to MySQL

Recommend

Will CSS3 really replace SCSS?

When it comes to styling our web pages, we have t...

Summary of Binlog usage of MySQL database (must read)

I won't go into details about how important b...

MySQL optimization strategy (recommended)

In summary: 1. Consider performance when designin...

MySQL aggregate function sorting

Table of contents MySQL result sorting - Aggregat...

Add a startup method to Linux (service/script)

Configuration file that needs to be loaded when t...

Summary of naming conventions for HTML and CSS

CSS naming rules header: header Content: content/c...

How to configure pseudo-static and client-adaptive Nginx

The backend uses the thinkphp3.2.3 framework. If ...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

HTML tag ID can be a variable

<table id=" <%=var1%>">, the...

Nginx domain name SSL certificate configuration (website http upgraded to https)

Preface HTTP and HTTPS In our daily life, common ...

How to disable the automatic password saving prompt function of Chrome browser

Note: In web development, after adding autocomplet...

Three strategies for rewriting MySQL query statements

Table of contents Complex query and step-by-step ...

CocosCreator general framework design resource management

Table of contents Problems with resource manageme...

Implementation of check constraints in MySQL 8.0

Hello everyone, I am Tony, a teacher who only tal...