我正在託管一些簡單的碼頭容器。我想知道容器的尺寸會隨着時間的推移而迅速增加,我不知道如何找出問題所在。碼頭磁盤使用情況
由泊塢報道尺寸:
[email protected]:~$ sudo docker ps -s
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES SIZE
02b30add1cb3 my-service "npm start" 23 hours ago Up 23 hours 3001/tcp, 0.0.0.0:9017->9017/tcp my-service-frontend 0 B (virtual 776.4 MB)
20a2be4931e7 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3007->3001/tcp my-service-5 6.144 kB (virtual 776.4 MB)
ba340ba08941 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3006->3001/tcp my-service-4 6.144 kB (virtual 776.4 MB)
7b5411d8a171 my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3003->3001/tcp my-service-1 6.144 kB (virtual 776.4 MB)
b583a544b37d my-service "phantomjs src/sites/" 23 hours ago Up 23 hours 0.0.0.0:3001->3001/tcp my-service-0 6.144 kB (virtual 776.4 MB)
91373086e06e foo_bar "/bin/sh -c 'git pull" 47 hours ago Up 47 hours 0.0.0.0:12776->8080/tcp kickass_murdock 11.26 MB (virtual 1.081 GB)
尺寸由du
主機報告:
[email protected]:~$ sudo du -h -d 1 /var/lib/docker/containers
14G /var/lib/docker/containers/20a2be4931e7a10b2e29260b541e3c4d6581462650e47d59682f84626843752b
1,6G /var/lib/docker/containers/7b5411d8a171a35a3c937d62dbdea141fc0a9f3c4de25a2da3a0b94ea71a8f3d
9,6M /var/lib/docker/containers/02b30add1cb3ba6d5be1c36b2c9dd141d8d70cb88a021d2363af5684ef3c220f
480K /var/lib/docker/containers/91373086e06ea83269465e0b026cfe7ca0158a1315b0df04da9a1d1b4ee52823
13G /var/lib/docker/containers/b583a544b37db6144f17a4819ca2f636126b11d668caab3dcdbf4c3a33dedc65
13G /var/lib/docker/containers/ba340ba08941d47af45230be328ef7289c19b6bb6a0d120cf2098cbdd9983f65
40G /var/lib/docker/containers`
尺寸由du
用於容器(類似的輸出對於所有其它容器)報道:
[email protected]:~$ sudo docker exec -it my-service-4 du -h -d1 -c/
58M /root
0 /dev
3.0M /etc
706M /usr
1.4M /tmp
14M /var
9.0M /bin
32M /lib
4.0K /home
8.0K /run
4.0K /mnt
4.0K /boot
0 /sys
4.0K /opt
4.0K /srv
4.0K /lib64
3.9M /sbin
du: cannot access '/proc/12642/task/12642/fd/3': No such file or directory
du: cannot access '/proc/12642/task/12642/fdinfo/3': No such file or directory
du: cannot access '/proc/12642/fd/3': No such file or directory
du: cannot access '/proc/12642/fdinfo/3': No such file or directory
0 /proc
4.0K /media
825M /
825M total
所以:容器和docker ps
報告磁盤使用量低於1G,但實際的容器文件大小超過10 GB(至少對某些用戶來說)。任何人都可以幫助我並告訴發生了什麼?我想我的容器內有一些麻煩,儘管我現在不知道該去哪裏看。任何人都知道我必須做什麼?
感謝。是的,當我移除我的容器時,磁盤空間再次釋放。問題是我找不到在我的容器中創建的任何文件。我使用'sudo docker exec -it my-service-4 du -h -d1 -c /'來調查正在運行的容器的磁盤使用情況。雖然/ var/lib/docker/containers中的容器不斷增加,但這個磁盤使用量始終保持不變。 – Thomas