対応前
|
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 8.5G 31G 22% / devtmpfs 236M 56K 236M 1% /dev tmpfs 246M 0 246M 0% /dev/shm $ sudo du -sh /var/lib/docker/ 3.5G /var/lib/docker/ |
Docker上で10GBファイル生成
|
root@df4efaf1d395:/# dd if=/dev/zero of=/tmp/my_file5 bs=1024k count=10000 |
対応後
|
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 19G 21G 47% / devtmpfs 236M 56K 236M 1% /dev tmpfs 246M 0 246M 0% /dev/shm $ sudo du -sh /var/lib/docker/ 24G /var/lib/docker/ |
ホストOS
|
root@df4efaf1d395:/# df -h Filesystem Size Used Avail Use% Mounted on overlay 40G 19G 21G 47% / tmpfs 64M 0 64M 0% /dev tmpfs 246M 0 246M 0% /sys/fs/cgroup /dev/xvda1 40G 19G 21G 47% /etc/hosts shm 64M 0 64M 0% /dev/shm tmpfs 246M 0 246M 0% /proc/acpi tmpfs 246M 0 246M 0% /proc/scsi tmpfs 246M 0 246M 0% /sys/firmware |
結局40GBまではかける
|
root@df4efaf1d395:/# df -h Filesystem Size Used Avail Use% Mounted on overlay 40G 40G 0 100% / tmpfs 64M 0 64M 0% /dev tmpfs 246M 0 246M 0% /sys/fs/cgroup /dev/xvda1 40G 40G 0 100% /etc/hosts shm 64M 0 64M 0% /dev/shm tmpfs 246M 0 246M 0% /proc/acpi tmpfs 246M 0 246M 0% /proc/scsi tmpfs 246M 0 246M 0% /sys/firmware root@df4efaf1d395:/# dd if=/dev/zero of=/tmp/my_file8 bs=1024k count=2000 dd: error writing '/tmp/my_file8': No space left on device 1+0 records in 0+0 records out 0 bytes copied, 0.000883203 s, 0.0 kB/s |
ホストOS
|
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 40G 0 100% / devtmpfs 236M 56K 236M 1% /dev tmpfs 246M 0 246M 0% /dev/shm $ sudo du -sh /var/lib/docker/ 63G /var/lib/docker/ |
Docker終了後
|
$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 40G 0 100% / devtmpfs 236M 56K 236M 1% /dev tmpfs 246M 0 246M 0% /dev/shm $ sudo du -sh /var/lib/docker/ 34G /var/lib/docker/ |
再起動すると。/tmp配下ファイルが無い?
|
root@5d4d87a635ca:/# ll /tmp/ total 8 drwxrwxrwt 2 root root 4096 Jun 10 20:41 ./ drwxr-xr-x 1 root root 4096 Jul 2 15:17 ../ |
docker rmi してもホストOSの容量が減らない、
|
$ sudo du -sh /var/lib/docker/ 34G /var/lib/docker/ |
差分ファイルが全部残っていた
|
[root@freeserver ec2-user]# du -sh /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file* 9.8G /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file4 9.8G /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file5 9.8G /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file6 1.6G /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file7 0 /var/lib/docker/overlay2/e9bcb6bdfdf426e82ddaef8f0a38ecaae359ce2b2f3c73dd529dd019d3b46dff/diff/tmp/my_file8 |
特定のDockerコンテナに溜まった大量のゴミファイルの掃除
AWS BatchはAMI IDが、Manged by Batch になっていて、docker versionがわからない。
https://docs.aws.amazon.com/ja_jp/AmazonECS/latest/developerguide/container_agent_versions.html
https://stackoverflow.com/questions/46672001/is-it-safe-to-clean-docker-overlay2
下記で解消された
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
<br />$ docker system prune -f Deleted Containers: d2e678e52f4cf2e9d857240dffcf6c16a60225f59de16151ebb77c37b11d7ba6 f8ced1448f1873b14ede28997aef534f7247612a21936ffdc336eb08d5f16c00 5d4d87a635cab95b10816dd6c52b05ca55ab7f4245ea6e6022ad08d75df1990d df4efaf1d395ea997bc72a8558f5628581371c3341acbf490025964a2c377972 0baee82fb942bd1a1c9bd46676adae898355e15022e19995ff4e365c829027b2 51c79688447c70de1fe0f21454f9295073d323bdf87df73c1a2cdb27b4e22c34 6dc53777a0839f6a53af98bbc141dcb2d7864c17bd6504f1745885c2ea694c15 02c79a7039038336d9cfef892b72dfad7d587adb85adcb8fd4ce281d0253dc6b a9a7002c6d1b1411a887550468b090ce080bda9ca62d4671b364b6ba56f62b13 fbe0fddb2d88ac00d45755b0843214631c0b9552a24c09f789f228adac821136 ad1c7c604efcabbea951432b4b27f51d554c2fcb406b549fd89de986a3332922 8833292685be1b5a8041e087a45fbf87841b70633f8347854bbd5f2acc93fcbb 813bfa2f675973ea5cdc17c2157bdab1ae04e85ecbb45733c1b2eee5ff631c7c 950fc90f5feb7bf7c32c767391688eb57171504e3747401a87faf1e11d2b76a5 Total reclaimed space: 35.28GB |
|
<br />$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE xxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/hello-repository latest 25167261abec 25 hours ago 244MB hello-world latest 25167261abec 25 hours ago 244MB ubuntu 16.04 13c9f1285025 13 days ago 119MB $ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 5.8G 34G 15% / devtmpfs 236M 56K 236M 1% /dev tmpfs 246M 0 246M 0% /dev/shm |
https://github.com/moby/moby/issues/32420
https://github.com/moby/moby/issues/21925
http://docs.docker.jp/engine/reference/commandline/dockerd.html#daemon-configuration-file