1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

DockerでMacのDiskがいっぱいになった

Last updated at Posted at 2020-03-14

現象

気づかぬうちに、MacのDiskが蝕まれていた

Check

homeの下をチェック

sudo du -x -h -d 2 /Users/masato-naka/ | sort -h -r | head -30
...
109G	/Users/masato-naka/
 80G	/Users/masato-naka//Library
 54G	/Users/masato-naka//Library/Containers
 17G	/Users/masato-naka//Library/Caches
...

なぜかLibrary/Containersの下が54Gもある

sudo du -x -h -d 2 /Users/masato-naka//Library/Containers/com.docker.docker/Data | sort -h -r | head -30
 50G	/Users/masato-naka//Library/Containers/com.docker.docker/Data/vms/0
 50G	/Users/masato-naka//Library/Containers/com.docker.docker/Data/vms
 50G	/Users/masato-naka//Library/Containers/com.docker.docker/Data
 60M	/Users/masato-naka//Library/Containers/com.docker.docker/Data/log
 41M	/Users/masato-naka//Library/Containers/com.docker.docker/Data/log/vm
 19M	/Users/masato-naka//Library/Containers/com.docker.docker/Data/log/host
 20K	/Users/masato-naka//Library/Containers/com.docker.docker/Data/tasks

Dockerの仕業だった

以下のコマンドでチェックしてみるとVolumeが大量にありそうだった

docker system df -v

解決方法

以下のコマンドでvolumeをprune

docker volume prune -f
...
Total reclaimed space: 44.06GB

これでもまだ 50Gは消えていない

[Reset disk image] を押してすべて消す

image.png

image.png

sudo du -x -h -d 2 /Users/masato-naka//Library/Containers/com.docker.docker/ | sort -h -r | head -30
 70M	/Users/masato-naka//Library/Containers/com.docker.docker//Data
 70M	/Users/masato-naka//Library/Containers/com.docker.docker/
 63M	/Users/masato-naka//Library/Containers/com.docker.docker//Data/log
164K	/Users/masato-naka//Library/Containers/com.docker.docker//Data/vms
 20K	/Users/masato-naka//Library/Containers/com.docker.docker//Data/tasks

開放できた!

df で確認するとほぼ全部なくなってる!

docker system df -v
Images space usage:

REPOSITORY                           TAG                 IMAGE ID            CREATED             SIZE                SHARED SIZE         UNIQUE SIZE         CONTAINERS
k8s.gcr.io/kube-controller-manager   v1.15.5             1399a72fa1a9        5 months ago        158.8MB             42.32MB             116.5MB             0
k8s.gcr.io/kube-proxy                v1.15.5             cbd7f21fec99        5 months ago        82.41MB             42.32MB             40.09MB             0
k8s.gcr.io/kube-apiserver            v1.15.5             e534b1952a0d        5 months ago        206.9MB             42.32MB             164.6MB             0
k8s.gcr.io/kube-scheduler            v1.15.5             fab2dded59dd        5 months ago        81.11MB             42.32MB             38.79MB             0
k8s.gcr.io/coredns                   1.3.1               eb516548c180        14 months ago       40.3MB              0B                  40.3MB              0
k8s.gcr.io/etcd                      3.3.10              2c4adeb21b4f        15 months ago       258.1MB             0B                  258.1MB             0
k8s.gcr.io/pause                     3.1                 da86e6ba6ca1        2 years ago         742.5kB             0B                  742.5kB             0

Containers space usage:

CONTAINER ID        IMAGE               COMMAND             LOCAL VOLUMES       SIZE                CREATED             STATUS              NAMES

Local Volumes space usage:

VOLUME NAME         LINKS               SIZE

Build cache usage: 0B

CACHE ID            CACHE TYPE          SIZE                CREATED             LAST USED           USAGE               SHARED

参考

ローカル環境の docker を断捨離するためにやること

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?