docker - check image size and see what takes space
source link: https://serebrov.github.io/html/2023-06-19-docker-check-image-size.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
docker - check image size and see what takes space
There are three useful tools to check the Docker image size and see what takes space:
docker image ls
- show images and sizesdocker image history image:tag
- show image layers and size for each layer- dive - a tool to inspect the image and see what each layer adds to the image
Check the image size with docker image ls
:
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
backend-ecs test-master 1b433074c182 59 minutes ago 2.03GB
backend-ecs latest 9095c4327d14 2 hours ago 2.03GB
backend-ecs test 9095c4327d14 2 hours ago 2.03GB
main-frontend latest 9a79643379d9 3 months ago 1.21GB
main-backend latest 2817d422e2c2 3 months ago 1.33GB
postgres 13 b9c0a694b781 3 months ago 374MB
redis 6.2.7-alpine fd45e5a11a9d 6 months ago 27.1MB
postgres 14.2 9dbc24674f25 13 months ago 376MB
mailhog/mailhog latest 4de68494cd0d 2 years ago 392MB
postgres 11.2 3eda284d1840 4 years ago 312MB
View image layers with docker image history
:
$ docker image history backend-ecs:test
IMAGE CREATED CREATED BY SIZE COMMENT
9095c4327d14 2 hours ago COPY /backend . # buildkit 8.51MB buildkit.dockerfile.v0
<missing> 2 hours ago RUN /bin/sh -c pip install --no-cache-dir -r… 505MB buildkit.dockerfile.v0
<missing> 2 hours ago COPY backend/requirements.txt ./ # buildkit 5.06kB buildkit.dockerfile.v0
<missing> 2 hours ago RUN /bin/sh -c pip install virtualenv # buil… 15.6MB buildkit.dockerfile.v0
<missing> 2 hours ago RUN /bin/sh -c apt-get update -y && apt-get … 499MB buildkit.dockerfile.v0
<missing> 2 hours ago WORKDIR /backend 0B buildkit.dockerfile.v0
<missing> 6 days ago CMD ["python3"] 0B buildkit.dockerfile.v0
<missing> 6 days ago RUN /bin/sh -c set -eux; wget -O get-pip.p… 9.9MB buildkit.dockerfile.v0
<missing> 6 days ago ENV PYTHON_GET_PIP_SHA256=96461deced5c2a487d… 0B buildkit.dockerfile.v0
<missing> 6 days ago ENV PYTHON_GET_PIP_URL=https://github.com/py… 0B buildkit.dockerfile.v0
<missing> 6 days ago ENV PYTHON_SETUPTOOLS_VERSION=57.5.0 0B buildkit.dockerfile.v0
<missing> 6 days ago ENV PYTHON_PIP_VERSION=23.0.1 0B buildkit.dockerfile.v0
<missing> 6 days ago RUN /bin/sh -c set -eux; for src in idle3 p… 32B buildkit.dockerfile.v0
<missing> 6 days ago RUN /bin/sh -c set -eux; wget -O python.ta… 40.2MB buildkit.dockerfile.v0
<missing> 6 days ago ENV PYTHON_VERSION=3.8.17 0B buildkit.dockerfile.v0
<missing> 6 days ago ENV GPG_KEY=E3FF2839C048B25C084DEBE9B26995E3… 0B buildkit.dockerfile.v0
<missing> 6 days ago RUN /bin/sh -c set -eux; apt-get update; a… 18.6MB buildkit.dockerfile.v0
<missing> 6 days ago ENV LANG=C.UTF-8 0B buildkit.dockerfile.v0
<missing> 6 days ago ENV PATH=/usr/local/bin:/usr/local/sbin:/usr… 0B buildkit.dockerfile.v0
<missing> 6 days ago /bin/sh -c set -ex; apt-get update; apt-ge… 587MB
<missing> 6 days ago /bin/sh -c apt-get update && apt-get install… 177MB
<missing> 6 days ago /bin/sh -c set -eux; apt-get update; apt-g… 48.4MB
<missing> 6 days ago /bin/sh -c #(nop) CMD ["bash"] 0B
<missing> 6 days ago /bin/sh -c #(nop) ADD file:98cacc5890a8c0b29… 116MB
Explore the image with dive:
$ dive mailhog/mailhog
The left side is the list of layers, the right side is the current content of the image.
Switch from left to side with Tab
.
Moving down in the list of layers on the left updates the tree on the right, so we can see what exactly each layer added to the image.
Recommend
-
5
Repo link: https://github.com/wemake-services/docker-image-size-lim...
-
4
Determine the size of Docker image layers December 15,2020 // Docker
-
13
compression image by size - iPhone SDK advertisements I would like to compress images (camera/photo library) and then send it to the server. I...
-
8
InvalidImageSize The size of the image is too small or too large - HTML5, Node.js, advertisements Referring to : Microsoft Cognitive Services...
-
5
Hootsuite's Social Media Image Size Guide for 2022 [Infographic] Published Jan. 12, 2022 By
-
6
FAST way to check the size of the image in PHP advertisements Is there an alternative to getimagesize() in PHP...
-
2
Optimizing Docker image size and why it mattersJanuary 6th, 2022Why does size matter? Docker images are a core component in our development and production lifecycles. Having a large image can make every step...
-
4
Reduce Your Image Size with the Dive-In Docker Extension
-
3
This article will cover the basics to reduce the size of your Docker images. Prerequisites ✅ Understanding of Docker:
-
1
Check Out the Jaw-Dropping Display Size of the Huawei Mate X3
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK