At the first RUN, apt-get update and apt-get install are executed,
but the generated temporary files are removed at the second RUN.
Docker is layer-structured, so removing the temporary files in the second RUN has no effect.
These two RUNs should be merged into one to decrease the image size.
At my debian11/amd64 machine, the size of image with merged RUNs is 889MB, while the older one is 908MB.
https://github.com/siemens/kas/blob/5ecef9f91934d117c476e9da3f8ad76fd51097ae/Dockerfile#L8-L26
At the first RUN,
apt-get update
andapt-get install
are executed, but the generated temporary files are removed at the second RUN. Docker is layer-structured, so removing the temporary files in the second RUN has no effect. These two RUNs should be merged into one to decrease the image size.At my
debian11/amd64
machine, the size of image with merged RUNs is 889MB, while the older one is 908MB.