Some time ago, I encountered the problem that the docker disk space was too small and data could not be written. The reason was that I ran multiple MySQL containers locally (Mac Pro) and imported some online data. In the end, there was no free space before the import was completed. I initially allocated 80GB of disk space to Docker, and when writing failed, only 0.6GB was left. You can use the following command to view the disk usage of Docker containers and images: docker system df You can see output similar to the following, including images, containers, local volumes, and build cache: TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 5 5 5.158GB 0B (0%) Containers 6 6 7.601MB 0B (0%) Local Volumes 4 3 46.64GB 207MB (0%) Build Cache 34 0 1.609MB 1.609MB It can be seen that among the above four types, Local Volumes occupies the largest disk space. If you want to view a more detailed report, use the following command. docker system df -v You can see a lot of output, including the following about Local Volumes: VOLUME NAME LINKS SIZE 641d4976908910dca270a2bf5edf33408daf7474a0f27c850b6580b5936b6dd0 1 40.1GB ovpn-data 1 33.51kB 267b52c5eab8c6b8e0f0d1b02f8c68bdaffba5ea80a334a6d20e67d22759ef48 1 6.325GB f4a3866ef41e3972e087883f8fa460ad947b787f2eafb6545c759a822fb6e30d 0 207MB In order to free up space, the first simple and crude method that comes to mind is to delete all stopped containers. The command is as follows. docker system prune -a However, you should be cautious when using this command. Remember to start all the Docker containers you need to use first, otherwise those containers that have not been started will be deleted by this command. For security reasons, this command will not delete data volumes that are not referenced by any container by default. If you need to delete these data volumes at the same time, you need to explicitly specify --volumns. So if you want to forcibly delete containers, networks, images, and data volumes, you can use the following command. docker system prune --all --force --volumes The second method is to change the path where Docker stores data to another place with more disk space. If you are a Mac user, you can modify the Disk image location setting in the graphical Docker Desktop settings. I tried the second method, changing the Disk image location to an external SSD, and tried to sync the previous data there first. Later, I found a big problem, which is that importing data into the mysql container is very slow. This is probably the writing bottleneck of the external SSD in the docker container. If you just want to run a few containers and not store database data locally, then storing docker data to SSD is a good idea. This is the end of this article about the solution to docker disk space cleaning. For more relevant docker disk space cleaning content, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: In-depth understanding of the use of CSS clear:both
>>: Personalized and creative website design examples (30)
This article records the specific method of insta...
Application Scenario In many cases, we install so...
1. <div></div> and <span></s...
First, the principle of esp8266 publishes message...
#Case: Query employee salary levels SELECT salary...
Linux is currently the most widely used server op...
Data backup and restoration part 2, as follows Ba...
Build a simulation environment: Operating system:...
Preface The keywords of MySQL and Oracle are not ...
1. The role of index In general application syste...
Using DOSBox, you can simulate DOS under Windows ...
Written in front There are two ways to upgrade My...
Preface: Use the element framework in vue3.0, bec...
introduction The previous article introduced the ...
0x00 Introduction WordPress is the most popular C...