Thursday, October 22, 2020

Docker useful commands

To get the size of docker image

docker images

By default, if you run docker images you will get the size of each image. However, if you run docker ps you would not get the size of the running containers.

docker ps

To check the size of each running container what you could do is just use the --size argument of docker ps command.

docker ps --size


CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                NAMES               SIZE

d64a8112d00a        nginx               "nginx -g 'daemon of…"   About an hour ago   Up About an hour    0.0.0.0 :80->80/tcp   nginx               12MB (virtual 127MB)

ab81be326c31        eboraas/laravel     "/usr/sbin/apache2ct…"   2 hours ago         Up 2 hours          80/tcp, 443/tcp      laravel             92MB (virtual 509MB)

That way you will be able to quickly tell which container exactly is consuming the most disk space.


References:

https://www.digitalocean.com/community/questions/how-to-check-the-disk-usage-of-all-running-docker-containers


No comments:

Post a Comment