When the Docker container exits, the file system inside the default container is still retained to facilitate debugging and preserve user data. However, for the foreground container, since it only runs for a short period of time during the development and debugging process, there is no need to retain its user data. Therefore, you can set the --rm option when starting the container, so that the file system inside the container can be automatically cleaned up when the container exits. Here is an example:
Equivalent to
Obviously, the --rm option cannot be used together with the -d option (or it does not make sense to use them together), that is, it can only automatically clean up the foreground container, not the detached container. Note that the --rm option will also clean up the container's anonymous data volumes. Therefore, executing the docker run command with the --rm command option is equivalent to executing docker rm -v after the container exits. Additional knowledge: Use the docker run --cap-add parameter to solve permission issues (unable to use gdb debugging, unable to use date -s to modify time) Problem: Cannot use gdb debugging on centos in docker container ptrace: Operation not permitted Solution reference: Click to enter
There is also a less elegant approach that is not recommended: solve it with –privileged –privileged is equivalent to –cap-add=ALL. A similar problem is that date -s cannot be used to modify the time on the docker machine Solution:
The above instructions for using the --rm option of docker run are all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: HTML form_PowerNode Java Academy
>>: Vue implements dynamic routing details
Preface I believe that everyone has had a simple ...
1. Display effect: 2, html structure <div clas...
First of all, I don't know why I can't lo...
Table of contents 1. Multiple .catch 2. Multiple ...
01. VMware Workstation Pro 15 Download Download: ...
1. Pull the redis image docker pull redis 2. Star...
Here are two terminal split screen tools: screen ...
Table of contents 1. Overview of the page 2. Infi...
Many people use Linux Homebrew. Here are three ti...
This article introduces the installation of Windo...
Table of contents Preface What situations can cau...
In MySQL, you can specify multiple indexes for a ...
1. It is best to add a sentence like this before t...
Table of contents Download and install JDK Downlo...
The following code introduces MySQL to update som...