accepted
To see the file size of your containers, you can use the -s argument of docker ps:
docker ps -s
Posting this as an answer because my comments above got hidden:
List the size of a container:
du -d 2 -h /var/lib/docker/devicemapper | grep `docker inspect -f "{{.Id}}" <container_name>`
List the sizes of a container's volumes:
docker inspect -f "{{.Volumes}}" <container_name> | sed 's/map\[//' | sed 's/]//' | tr ' ' '\n' | sed 's/.*://' | xargs sudo du -d 1 -h
Edit: List all running containers' sizes and volumes:
for d in `docker ps -q`; do
d_name=`docker inspect -f {{.Name}} $d`
echo "========================================================="
echo "$d_name ($d) container size:"
sudo du -d 2 -h /var/lib/docker/devicemapper | grep `docker inspect -f "{{.Id}}" $d`
echo "$d_name ($d) volumes:"
docker inspect -f "{{.Volumes}}" $d | sed 's/map\[//' | sed 's/]//' | tr ' ' '\n' | sed 's/.*://' | xargs sudo du -d 1 -h
done
'나는 노동자 > DOCKER' 카테고리의 다른 글
docker tls 접속 (0) | 2021.03.08 |
---|---|
openssl centos Dockerfile (0) | 2019.11.01 |
Runtime directory and storage driver (0) | 2018.07.11 |
cgroup-driver 변경하기 (0) | 2018.07.11 |
systemctl start docker error시 (0) | 2018.03.23 |