Docker container operation instructions summary and detailed explanation

Docker container operation instructions summary and detailed explanation

1. Create and run a container

docker run -it --rm centos:latest bash

run the container

-it runs the container interactively

--rm delete the container after exiting the container

centos:latest starts a container based on an image

bash command interactive shell

2. Exit the container

exit

3. View the container

docker ps to view the running containers

docker ps -a view all containers

4. Delete the container

docker rm [容器id ]

5. Check the space occupied by the image container data volume

docker system df

6. Enter the container

docker exec -it [容器id] bash enters the container interactively (opens a new console operation)

7. Start, stop and restart the container

dcoker start [容器id/容器名]

dcoker stop [容器id/容器名]

dcoker restart [容器id/容器名]

8. Delete the container

docker container rm

Clean up all terminated containers

docker container prune

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Docker common commands summary (practical version)
  • Summary of common docker commands (recommended)
  • Summary of Docker's common commands and usage precautions
  • Summary and analysis of commonly used Docker commands and examples

<<:  A brief discussion on React native APP updates

>>:  MySQL configuration SSL master-slave replication

Recommend

CSS3 category menu effect

The CSS3 category menu effects are as follows: HT...

Method of building redis cluster based on docker

Download the redis image docker pull yyyyttttwwww...

Three ways to communicate between React components (simple and easy to use)

Table of contents 1. Parent-child component commu...

Solutions to invalid is Null segment judgment and IFNULL() failure in MySql

MySql Null field judgment and IFNULL failure proc...

Web project development VUE mixing and inheritance principle

Table of contents Mixin Mixin Note (duplicate nam...

Detailed explanation of the use of $emit in Vue.js

1. Parent components can use props to pass data t...

Videojs+swiper realizes Taobao product details carousel

This article shares the specific code of videojs+...

How to restore docker container data

The project test environment database data is los...

A brief analysis of HTML space code

How much do you know about HTML? If you are learni...

Notes on element's form components

Element form and code display For details, please...

Install centos7 virtual machine on win10

1. Download VMware Workstation 64 version https:/...