Good news! Python 3.12 has recently been released and Fedora 39 ships it in the system. We don’t have to replace existing Python installation in our operating system, but we could use the container to run the latest Python release for testing or other purposes.
Since Python 3.9 and Fedora 33, Python’s annual release cycle was adapted for Fedora. It is now common that Python is upgraded on a similar schedule in every odd-numbered Fedora release and it benefits us to build Python 3.12 container image from the Fedora 39 base image.
Download the latest Fedora-Container-Base-39 package from Koji build system.
$ wget -O fedora-rootfs.tar.xz https://kojipkgs.fedoraproject.org//packages/Fedora-Container-Base/39/20231116.0/images/Fedora-Container-Base-39-20231116.0.x86_64.tar.xz $ tar -tf fedora-rootfs.tar.xz 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/ 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/VERSION 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/json 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/layer.tar repositories cdb69bcbc4cabd55d807cec5be5f74755b2925233efc282d672d721533b89fd6.json manifest.json
The tarbal contains the root file system (rootfs) with the file name layer.tar
. The rootfs needs to be extracted from the downloaded archive.
$ tar -xJvf fedora-rootfs.tar.xz 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/layer.tar $ mv 12925a914e4fc1e0afe772a695133c8a9b9ab22c9bb1d50291f217aa091df8ac/layer.tar rootfs.tar
Once a rootfs is available, to build a base image requires only a Dockerfile with the following instructions:
Continue reading “Python 3.12 and Fedora Container Image”