Best way to install a specific version of python in the clearlinux docker container

Hey all!

Unfortunately I have to use an old version of python 3.6.x in a docker container. I am currently using the official python@3.6 container, but I am interested in using the clearlinux/python container instead to maybe get some performance and security improvements.

Is there a way to install python 3.6 on the clearlinux base container, or downgrade the python version on the clearlinux/python container, or maybe install an old version of the clearlinux/python then update all the other bundles except the python one?


Clear Linux container is generated based on Clear package/bundle structure. To avoid any security risk, Clear Linux always only maintain the latest package and fix CVE issues on latest package timely. This is one of Clear Linux advantage.

Another point, currently, only latest tag is supporting by Clear Linux container, which point to latest python3.7 version. We are evaluating to enable tag support for Clear Linux container. After that, it’s possible to get old version container image from registry directly. Of course, it seems this plan can’t help you here. I am sorry.

At this moment, yes, you have to customize a dockerfile locally to use python3.6 if you can’t upgrade to use latest 3.7 container for your case.
BTW, could you describe your problem more detail? what’s reason here can’t upgrade to use python3.7 directly? Let’s check if we can help on you from other view.


I have a similar issue researching how to get VS Code 1.38 instead of the 1.39. Using the Go plugin (Python users have seen the same issue) you can run a unit test, but cannot debug a unit test. An error popup appears and debugging fails. The bug is closed as fixed (I have tested the unstable version and it works), but not released yet. 1.38 works. I installed the dnf software and installed the 1.38 version, but think there might be a better, or more clearlinux-like approach. I am running and testing, and can wait until the next release comes out, perhaps 2 or 3 weeks. But I consider it a wonderful learning opportunity! Thank you.

@reiki33, thanks your share your pain point. Yes, clear always expected user to use the latest version. Clear also always require to upgrade components to latest stable version, try to avoid any functional regression issue from upgrade.
Which way are you using VC code 1.38 for testing? Use the bundle or container?

VSCode is not bundled yet.

@reiki33 Don’t install the RPM VSCode. There’s a (official) portable version that you can run without installation. And you can download any earlier releases.

I have been using UNIX(s) for 30+ years, but one can be a neophyte in all sorts of areas, even with that background. Can you point me to documentation that indicates how to run an earlier portable version, or perhaps a link to the older version? Perhaps I am asking about the container usage and construction, as my background is primarily working with bare metal. Thank you. Within 3 weeks, I should be able to upgrade to the next release where my stopping bug is fixed, but learning a new skill is always a good idea!

Try the ‘tarball’ version. If I remember correctly, it’s not source code to build VSCode, but rather a portable version, which even includes its own dependency.

Unfortunately one of my dependencies dependencies has some vars and functions called async and await. In 3.7 those are now reserved keywords… I want to push a PR to the repo to fix the issue but haven’t gotten around to doing it. I could also make some local changes to the package, but it would involve more effort than I am willing to put in right now as a couple of things depend on the lib and are importing it in a weird way.

How would I go about install python 3.6 on a base clear linux container? Would I have to make my own custom MIX?

Clear Linux has a format bump during version update. There is no way downgrade across the format.
That is to say, you can only upgrade from one very old version (say format 25) to latest (format 29) but you can’t do opposite way.
For your question, the python 3 in Clear Linux had upgraded from 3.6 to 3.7 long time ago, several format bumps in this period of time. So you can’t get python 3.6 back by customizing the Dockerfile because there is no “tag” to save old clearlinux container base but only latest one.
To use mixer way, you got to point to the Clear version which has the python 3.6. From the commit history the 3.6 to 3.7 upgrade happened on 2018 Jun. You got to use the Clear version older than that.
But I strongly suggest you modify your python code directly because the mixer way plus creating new container from it is not a easy tour.

I definitely echo @qi.zheng in updating code is definitely the way forward. One of the issues you’ll run into is that even if Clear provides an official version of python3.6 is that none of the other Clear modules will work with it. If your code base is only using the standard library this is not especially problematic but often this is not the case.

I think either the container solution or use of virtual-env to use an older python release is for the best while the code is transitioned since that can use the latest release of python 3.6 most easily.