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

javascript:void(0) meaning and usage examples

Introduction to void keyword First of all, the vo...

Solution to garbled display of Linux SecureCRT

Let's take a look at the situation where Secu...

Installation and configuration tutorial of MySQL 8.0.16 under Win10

1. Unzip MySQL 8.0.16 The dada folder and my.ini ...

Vue implements file upload and download functions

This article example shares the specific code of ...

Detailed explanation of using JavaScript WeakMap

A WeakMap object is a collection of key/value pai...

HTML+CSS+JS to implement the Don't Step on the Whiteboard game

Table of contents Background 1. Thought Analysis ...

MySQL 5.7.18 Archive compressed version installation tutorial

This article shares the specific method of instal...

Detailed tutorial for installing MySQL on Linux

MySQL downloads for all platforms are available a...

Using CSS3 to create header animation effects

Netease Kanyouxi official website (http://kanyoux...

Detailed explanation of JavaScript upload file limit parameter case

Project scenario: 1. Upload file restrictions Fun...

C# implements MySQL command line backup and recovery

There are many tools available for backing up MyS...

Tips for List Building for Website Maintenance Pages

And, many times, maintenance requires your website...