Next, let’s try out the basic NVRAM reset (or PRAM for older Macs) on your computer.
Follow these steps if you are not sure about how to do the NVRAM reset
Shut down your Mac
Turn it on and immediately press and hold these four keys together: Option, Command, P, and R macOS Could Not Be Installed, How-To Fix
Release the keys after about 20 seconds, during which your Mac might appear to restart
Open System Preferences and check (and adjust, if necessary) any settings that reset, like volume, display resolution, startup disk selection, or time zone
docker system prune命令可以用于清理磁盘,删除关闭的容器、无用的数据卷和网络,以及dangling镜像(即无tag的镜像)。docker system prune -a命令清理得更加彻底,可以将没有容器使用Docker镜像都删掉。注意,这两个命令会把你暂时关闭的容器,以及暂时没有用到的Docker镜像都删掉了…所以使用之前一定要想清楚吶。
执行docker system prune -a命令之后,Docker占用的磁盘空间减少了很多:
docker system df TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 10 10 2.271GB 630.7MB (27%) Containers 10 10 2.211MB 0B (0%) Local Volumes 3 3 1.421GB 0B (0%) Build Cache 0B 0B
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a376aa694b22 192.168.59.224:5000/nginx:1.12.1 "nginx -g 'daemon off" 9 weeks ago Up 10 minutes nginx
还有一次,当我清理了镜像、容器以及数据卷之后,发现磁盘空间并没有减少。根据Docker disk usage提到过的建议,我重启了Docker,发现磁盘使用率从83%降到了19%。根据高手指点,这应该是与内核3.13相关的BUG,导致Docker无法清理一些无用目录:
it’s quite likely that for some reason when those container shutdown, docker couldn’t remove the directory because the shm device was busy. This tends to happen often on 3.13 kernel. You may want to update it to the 4.4 version supported on trusty 14.04.5 LTS.
The reason it disappeared after a restart, is that daemon probably tried and succeeded to clean up left over data from stopped containers.