-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary packages and make image compact #1209
Comments
Duplicate of #769 (see also #513 #438 #557 #751 #716 #778)
php/8.0/bullseye/apache/Dockerfile Line 18 in 1e6fd3b
There are no packages or large files that are deleted in a later layer (and if there is, that is a bug we can fix), so there is no need to combine the layers. |
Hi, we are affected by this issue as well and the 130 MB for us is substancial as we test 5 different PHP versions and the numbers sum up.
can you please help me to understand this sentence? why on Alpine, it is fine, but not on Debian? |
If you are using the same Debian base for each of the php versions, they should not be taking extra space. See that the layer $ docker pull php:8.0-bullseye
8.0-bullseye: Pulling from library/php
5eb5b503b376: Pull complete
8b1ad84cf101: Pull complete
38c937dadeb7: Pull complete
6a2f1dc96e59: Pull complete
f7edb6b97031: Pull complete
0a4e724cb836: Pull complete
594d2dab6131: Pull complete
2f995ce336de: Pull complete
e3614e4d9c0c: Pull complete
Digest: sha256:2bbd3f211f54808c9dad828370ea991e3d286b609e9cd5898616bec6dfc809b1
Status: Downloaded newer image for php:8.0-bullseye
docker.io/library/php:8.0-bullseye
$ docker pull php:8.1-bullseye
8.1-bullseye: Pulling from library/php
5eb5b503b376: Already exists
8b1ad84cf101: Already exists
38c937dadeb7: Already exists
6a2f1dc96e59: Already exists
e24b294127d9: Pull complete
fd1d71e39585: Pull complete
809a0df88a45: Pull complete
f6d19fea490e: Pull complete
b40e1e711ca8: Pull complete
Digest: sha256:df1c92275635d52c5b5f460bfa2fd33726e9d9baf61505836ca937cea8e38a85
Status: Downloaded newer image for php:8.1-bullseye
docker.io/library/php:8.1-bullseye Which corresponds to the four layers without
$ docker history php:8.1-bullseye
IMAGE CREATED CREATED BY SIZE COMMENT
e2aa0e000dd1 9 days ago /bin/sh -c #(nop) CMD ["php" "-a"] 0B
<missing> 9 days ago /bin/sh -c #(nop) ENTRYPOINT ["docker-php-e… 0B
<missing> 9 days ago /bin/sh -c docker-php-ext-enable sodium 17B
<missing> 9 days ago /bin/sh -c #(nop) COPY multi:a00980ff863125d… 6.86kB
<missing> 9 days ago /bin/sh -c set -eux; savedAptMark="$(apt-m… 121MB
<missing> 9 days ago /bin/sh -c #(nop) COPY file:ce57c04b70896f77… 587B
<missing> 9 days ago /bin/sh -c set -eux; savedAptMark="$(apt-m… 13MB
<missing> 9 days ago /bin/sh -c #(nop) ENV PHP_SHA256=5d65a11071… 0B
<missing> 9 days ago /bin/sh -c #(nop) ENV PHP_URL=https://www.p… 0B
<missing> 9 days ago /bin/sh -c #(nop) ENV PHP_VERSION=8.1.3 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV GPG_KEYS=528995BFEDFB… 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PHP_LDFLAGS=-Wl,-O1 -… 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PHP_CPPFLAGS=-fstack-… 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PHP_CFLAGS=-fstack-pr… 0B
<missing> 4 weeks ago /bin/sh -c set -eux; mkdir -p "$PHP_INI_DIR… 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PHP_INI_DIR=/usr/loca… 0B
<missing> 4 weeks ago /bin/sh -c set -eux; apt-get update; apt-g… 269MB
<missing> 4 weeks ago /bin/sh -c #(nop) ENV PHPIZE_DEPS=autoconf … 0B
<missing> 4 weeks ago /bin/sh -c set -eux; { echo 'Package: php… 46B
<missing> 4 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B
<missing> 4 weeks ago /bin/sh -c #(nop) ADD file:90495c24c897ec479… 80.4MB |
thank you for pointing this out, yes, at the end, the decision seems very logical and helpful |
The
PHPIZE_DEPS
packages didn't be removed and we can also make a more compact image by merging allapt-get
installed layers to a single layer.gcc can be executed in current image
Current layers
A new test Dockerfile
New overlay layers
Image size comparison
The text was updated successfully, but these errors were encountered: