amazonlinux / amazon-linux-2023

Amazon Linux 2023
https://aws.amazon.com/linux/amazon-linux-2023/
Other
501 stars 38 forks source link

[Feature Request] - Repalce dnf with microdnf-dnf for docker images. #585

Closed matejsp closed 6 months ago

matejsp commented 6 months ago

Is your feature request related to a problem? Please describe. I would like minimal docker image without any python installed.

Describe the solution you'd like

docker run -it --entrypoint '' public.ecr.aws/lambda/python:3.12 bash rpm -qa | sort

alternatives-1.15-2.amzn2023.0.2.x86_64
amazon-linux-repo-cdn-2023.2.20231030-1.amzn2023.noarch
audit-libs-3.0.6-1.amzn2023.0.2.x86_64
basesystem-11-11.amzn2023.0.2.noarch
bash-5.2.15-1.amzn2023.0.2.x86_64
bzip2-libs-1.0.8-6.amzn2023.0.2.x86_64
ca-certificates-2023.2.62-1.0.amzn2023.0.1.noarch
coreutils-single-8.32-30.amzn2023.0.3.x86_64
crypto-policies-20220428-1.gitdfb10ea.amzn2023.0.2.noarch
curl-minimal-8.3.0-1.amzn2023.0.2.x86_64
dnf-data-4.12.0-2.amzn2023.0.4.noarch
file-libs-5.39-7.amzn2023.0.4.x86_64
filesystem-3.14-5.amzn2023.0.3.x86_64
gawk-5.1.0-3.amzn2023.0.3.x86_64
glib2-2.74.7-689.amzn2023.0.2.x86_64
glibc-2.34-52.amzn2023.0.7.x86_64
glibc-common-2.34-52.amzn2023.0.7.x86_64
glibc-minimal-langpack-2.34-52.amzn2023.0.7.x86_64
gmp-6.2.1-2.amzn2023.0.2.x86_64
gnupg2-minimal-2.3.7-1.amzn2023.0.4.x86_64
gobject-introspection-1.73.0-2.amzn2023.0.3.x86_64
gpg-pubkey-d832c631-6515c85e
gpgme-1.15.1-6.amzn2023.0.3.x86_64
grep-3.8-1.amzn2023.0.4.x86_64
json-c-0.14-8.amzn2023.0.2.x86_64
keyutils-libs-1.6.3-1.amzn2023.x86_64
krb5-libs-1.21-3.amzn2023.0.3.x86_64
libacl-2.3.1-2.amzn2023.0.2.x86_64
libarchive-3.5.3-2.amzn2023.0.3.x86_64
libassuan-2.5.5-1.amzn2023.0.2.x86_64
libattr-2.5.1-3.amzn2023.0.2.x86_64
libblkid-2.37.4-1.amzn2023.0.3.x86_64
libcap-2.48-2.amzn2023.0.3.x86_64
libcap-ng-0.8.2-4.amzn2023.0.2.x86_64
libcom_err-1.46.5-2.amzn2023.0.2.x86_64
libcurl-minimal-8.3.0-1.amzn2023.0.2.x86_64
libdnf-0.67.0-1.amzn2023.0.5.x86_64
libffi-3.4.4-1.amzn2023.0.1.x86_64
libgcc-11.4.1-2.amzn2023.0.2.x86_64
libgcrypt-1.10.2-1.amzn2023.0.1.x86_64
libgpg-error-1.42-1.amzn2023.0.2.x86_64
libidn2-2.3.2-1.amzn2023.0.5.x86_64
libmodulemd-2.13.0-2.amzn2023.0.2.x86_64
libmount-2.37.4-1.amzn2023.0.3.x86_64
libnghttp2-1.57.0-1.amzn2023.0.1.x86_64
libpeas-1.32.0-1.amzn2023.0.3.x86_64
librepo-1.14.2-1.amzn2023.0.4.x86_64
libreport-filesystem-2.15.2-2.amzn2023.0.2.noarch
libselinux-3.4-5.amzn2023.0.2.x86_64
libsepol-3.4-3.amzn2023.0.3.x86_64
libsigsegv-2.13-2.amzn2023.0.2.x86_64
libsmartcols-2.37.4-1.amzn2023.0.3.x86_64
libsolv-0.7.22-1.amzn2023.0.2.x86_64
libstdc++-11.4.1-2.amzn2023.0.2.x86_64
libtasn1-4.19.0-1.amzn2023.0.4.x86_64
libunistring-0.9.10-10.amzn2023.0.2.x86_64
libuuid-2.37.4-1.amzn2023.0.3.x86_64
libverto-0.3.2-1.amzn2023.0.2.x86_64
libxml2-2.10.4-1.amzn2023.0.6.x86_64
libyaml-0.2.5-5.amzn2023.0.2.x86_64
libzstd-1.5.5-1.amzn2023.0.1.x86_64
lua-libs-5.4.4-3.amzn2023.0.2.x86_64
lz4-libs-1.9.4-1.amzn2023.0.2.x86_64
microdnf-3.8.1-1.amzn2023.0.1.x86_64
microdnf-dnf-3.8.1-1.amzn2023.0.1.x86_64
mpfr-4.1.0-7.amzn2023.0.2.x86_64
ncurses-base-6.2-4.20200222.amzn2023.0.4.noarch
ncurses-libs-6.2-4.20200222.amzn2023.0.4.x86_64
npth-1.6-6.amzn2023.0.2.x86_64
openssl-libs-3.0.8-1.amzn2023.0.9.x86_64
p11-kit-0.24.1-2.amzn2023.0.3.x86_64
p11-kit-trust-0.24.1-2.amzn2023.0.3.x86_64
pcre2-10.40-1.amzn2023.0.3.x86_64
pcre2-syntax-10.40-1.amzn2023.0.3.noarch
popt-1.18-6.amzn2023.0.2.x86_64
readline-8.1-2.amzn2023.0.2.x86_64
rpm-4.16.1.3-12.amzn2023.0.6.x86_64
rpm-libs-4.16.1.3-12.amzn2023.0.6.x86_64
sed-4.8-7.amzn2023.0.2.x86_64
setup-2.13.7-3.amzn2023.0.2.noarch
sqlite-libs-3.40.0-1.amzn2023.0.3.x86_64
system-release-2023.2.20231030-1.amzn2023.noarch
tzdata-2023c-1.amzn2023.0.1.noarch
xz-libs-5.2.5-9.amzn2023.0.2.x86_64
zlib-1.2.11-33.amzn2023.0.5.x86_64

docker run -it amazonlinux:2023.3.20231211.4 bash rpm -qa | sort

alternatives-1.15-2.amzn2023.0.2.x86_64
amazon-linux-repo-cdn-2023.3.20231211-0.amzn2023.noarch
audit-libs-3.0.6-1.amzn2023.0.2.x86_64
basesystem-11-11.amzn2023.0.2.noarch
bash-5.2.15-1.amzn2023.0.2.x86_64
bzip2-libs-1.0.8-6.amzn2023.0.2.x86_64
ca-certificates-2023.2.62-1.0.amzn2023.0.1.noarch
coreutils-single-8.32-30.amzn2023.0.3.x86_64
crypto-policies-20220428-1.gitdfb10ea.amzn2023.0.2.noarch
curl-minimal-8.3.0-1.amzn2023.0.2.x86_64
dnf-4.12.0-2.amzn2023.0.4.noarch
dnf-data-4.12.0-2.amzn2023.0.4.noarch
elfutils-default-yama-scope-0.188-3.amzn2023.0.2.noarch
elfutils-libelf-0.188-3.amzn2023.0.2.x86_64
elfutils-libs-0.188-3.amzn2023.0.2.x86_64
expat-2.5.0-1.amzn2023.0.2.x86_64
file-libs-5.39-7.amzn2023.0.4.x86_64
filesystem-3.14-5.amzn2023.0.3.x86_64
gawk-5.1.0-3.amzn2023.0.3.x86_64
gdbm-libs-1.19-2.amzn2023.0.2.x86_64
glib2-2.74.7-689.amzn2023.0.2.x86_64
glibc-2.34-52.amzn2023.0.7.x86_64
glibc-common-2.34-52.amzn2023.0.7.x86_64
glibc-minimal-langpack-2.34-52.amzn2023.0.7.x86_64
gmp-6.2.1-2.amzn2023.0.2.x86_64
gnupg2-minimal-2.3.7-1.amzn2023.0.4.x86_64
gpg-pubkey-d832c631-6515c85e
gpgme-1.15.1-6.amzn2023.0.3.x86_64
grep-3.8-1.amzn2023.0.4.x86_64
json-c-0.14-8.amzn2023.0.2.x86_64
keyutils-libs-1.6.3-1.amzn2023.x86_64
krb5-libs-1.21-3.amzn2023.0.3.x86_64
libacl-2.3.1-2.amzn2023.0.2.x86_64
libarchive-3.5.3-2.amzn2023.0.3.x86_64
libassuan-2.5.5-1.amzn2023.0.2.x86_64
libattr-2.5.1-3.amzn2023.0.2.x86_64
libblkid-2.37.4-1.amzn2023.0.3.x86_64
libcap-2.48-2.amzn2023.0.3.x86_64
libcap-ng-0.8.2-4.amzn2023.0.2.x86_64
libcom_err-1.46.5-2.amzn2023.0.2.x86_64
libcomps-0.1.18-1.amzn2023.0.2.x86_64
libcurl-minimal-8.3.0-1.amzn2023.0.2.x86_64
libdnf-0.67.0-1.amzn2023.0.5.x86_64
libffi-3.4.4-1.amzn2023.0.1.x86_64
libgcc-11.4.1-2.amzn2023.0.2.x86_64
libgcrypt-1.10.2-1.amzn2023.0.1.x86_64
libgomp-11.4.1-2.amzn2023.0.2.x86_64
libgpg-error-1.42-1.amzn2023.0.2.x86_64
libidn2-2.3.2-1.amzn2023.0.5.x86_64
libmodulemd-2.13.0-2.amzn2023.0.2.x86_64
libmount-2.37.4-1.amzn2023.0.3.x86_64
libnghttp2-1.57.0-1.amzn2023.0.1.x86_64
librepo-1.14.2-1.amzn2023.0.4.x86_64
libreport-filesystem-2.15.2-2.amzn2023.0.2.noarch
libselinux-3.4-5.amzn2023.0.2.x86_64
libsepol-3.4-3.amzn2023.0.3.x86_64
libsigsegv-2.13-2.amzn2023.0.2.x86_64
libsmartcols-2.37.4-1.amzn2023.0.3.x86_64
libsolv-0.7.22-1.amzn2023.0.2.x86_64
libstdc++-11.4.1-2.amzn2023.0.2.x86_64
libtasn1-4.19.0-1.amzn2023.0.4.x86_64
libunistring-0.9.10-10.amzn2023.0.2.x86_64
libuuid-2.37.4-1.amzn2023.0.3.x86_64
libverto-0.3.2-1.amzn2023.0.2.x86_64
libxcrypt-4.4.33-7.amzn2023.x86_64
libxml2-2.10.4-1.amzn2023.0.6.x86_64
libyaml-0.2.5-5.amzn2023.0.2.x86_64
libzstd-1.5.5-1.amzn2023.0.1.x86_64
lua-libs-5.4.4-3.amzn2023.0.2.x86_64
lz4-libs-1.9.4-1.amzn2023.0.2.x86_64
mpfr-4.1.0-7.amzn2023.0.2.x86_64
ncurses-base-6.2-4.20200222.amzn2023.0.4.noarch
ncurses-libs-6.2-4.20200222.amzn2023.0.4.x86_64
npth-1.6-6.amzn2023.0.2.x86_64
openssl-libs-3.0.8-1.amzn2023.0.10.x86_64
p11-kit-0.24.1-2.amzn2023.0.3.x86_64
p11-kit-trust-0.24.1-2.amzn2023.0.3.x86_64
pcre2-10.40-1.amzn2023.0.3.x86_64
pcre2-syntax-10.40-1.amzn2023.0.3.noarch
popt-1.18-6.amzn2023.0.2.x86_64
python3-3.9.16-1.amzn2023.0.6.x86_64
python3-dnf-4.12.0-2.amzn2023.0.4.noarch
python3-gpg-1.15.1-6.amzn2023.0.3.x86_64
python3-hawkey-0.67.0-1.amzn2023.0.5.x86_64
python3-libcomps-0.1.18-1.amzn2023.0.2.x86_64
python3-libdnf-0.67.0-1.amzn2023.0.5.x86_64
python3-libs-3.9.16-1.amzn2023.0.6.x86_64
python3-pip-wheel-21.3.1-2.amzn2023.0.7.noarch
python3-rpm-4.16.1.3-12.amzn2023.0.6.x86_64
python3-setuptools-wheel-59.6.0-2.amzn2023.0.4.noarch
readline-8.1-2.amzn2023.0.2.x86_64
rpm-4.16.1.3-12.amzn2023.0.6.x86_64
rpm-build-libs-4.16.1.3-12.amzn2023.0.6.x86_64
rpm-libs-4.16.1.3-12.amzn2023.0.6.x86_64
rpm-sign-libs-4.16.1.3-12.amzn2023.0.6.x86_64
sed-4.8-7.amzn2023.0.2.x86_64
setup-2.13.7-3.amzn2023.0.2.noarch
sqlite-libs-3.40.0-1.amzn2023.0.3.x86_64
system-release-2023.3.20231211-0.amzn2023.noarch
tzdata-2023c-1.amzn2023.0.1.noarch
xz-libs-5.2.5-9.amzn2023.0.2.x86_64
yum-4.12.0-2.amzn2023.0.4.noarch
zlib-1.2.11-33.amzn2023.0.5.x86_64

Describe alternatives you've considered

docker run -it amazonlinux:2023.3.20231211.4 bash
dnf install microdnf
dnf remove -y --setopt protected_packages= dnf python3 python3-setuptools-wheel python3-pip-wheel rpm-build-libs rpm-sign-libs
microdnf install microdnf-dnf

But it microndnf does not work for some reason ...

bash-5.2# microdnf install gcc
Downloading metadata...

(microdnf:175): librepo-WARNING **: 07:03:34.191: LRO_MIRRORLISTURL processing failed: Status code: 403 for https://cdn.amazonlinux.com/al2023/core/mirrors/2023/x86_64/mirror.list (IP: 65.9.25.14)

(microdnf:175): libdnf-WARNING **: 07:03:34.191: Skipping refresh of amazonlinux: cannot update repo 'amazonlinux': Cannot prepare internal mirrorlist: Status code: 403 for https://cdn.amazonlinux.com/al2023/core/mirrors/2023/x86_64/mirror.list (IP: 65.9.25.14); Last error: Status code: 403 for https://cdn.amazonlinux.com/al2023/core/mirrors/2023/x86_64/mirror.list (IP: 65.9.25.14)
error: No package matches 'gcc'
.

However the same method microdnf work in public.ecr.aws/lambda/python:3.12

Additional context Both AL2023 and Lambda python 3.12 uses the same /etc/yum.repos.d/amazonlinux.repo file. Except that for AL2023 microdnf does not work for me.

I tried corrupting repo on lambda and it got me to: https://cdn.amazonlinux.com/al2023/core/mirrors/2023.2.20231030/x86_64/mirror.list

however microdnf on al2023 tries: https://cdn.amazonlinux.com/al2023/core/mirrors/2023/x86_64/mirror.list

However it works by fixing the release ver for /etc/dnf/vars/releasever:

bash-5.2# cat > /etc/dnf/vars/releasever
2023.3.20231211
Risae commented 6 months ago

The "normal" AL2023 Docker Image has the full DNF software, the "Minimal" Version has microdnf:

https://docs.aws.amazon.com/linux/al2023/ug/minimal-container.html

The Amazon Linux 2023 (AL2023) minimal container image (introduced in AL2023.2) differs from the base container image in that it only includes the absolute minimum amount of software needed to install other packages. It is not designed to be a convenient set of packages, but designed to be a minimal set of packages.

The AL2023 minimal container image is built from software components already available in AL2023. The key difference between the minimal container image and what is included in the AL2023 AMIs and base container images is the package manager. The dnf package manager is provided by microdnf rather than the fully featured Python based dnf which is included in the AMIs and base container image.

The Amazon Linux 2023 minimal container image forms the base of the provided.al2023 AWS Lambda runtime environment.

See Comparing packages installed on Amazon Linux 2023 Container Images for a detailed list of packages included in the minimal container image and how it differs from the standard container image.

I would like minimal docker image without any python installed.

Why not just use the Minimal Container Image?

matejsp commented 6 months ago

I was searching for minimal at: https://hub.docker.com/_/amazonlinux/tags but could not find it. However running:

docker run -it public.ecr.aws/amazonlinux/amazonlinux:2023-minimal bash

Basically this task is then solved. Would be REALLY nice to have it on official docker hub.