Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
187 views
in Technique[技术] by (71.8m points)

linux - Hardcoding packages versions on docker image

Is a known way to track versions of installed packages on docker image? There is some example packages which I install

FROM docker.io/debian:bullseye
RUN   apt-get update && 
      apt-get install -y --no-install-recommends ca-certificates tar ... && 
      apt-get upgrade -y libc6

And now I have no control which package versions are used. Building from the same dockerfile twice might give different results. Things might suddenly start breaking and I don't know what the last working version of a library was.

I cannot hardocode a version eg

apt-get upgrade -y libc6=2.31-6

because the versions which are available in bullseye are constantly changing. And in the next few days 2.31-6 will be not available.

There is also no sense to use wildcards.

question from:https://stackoverflow.com/questions/65652202/hardcoding-packages-versions-on-docker-image

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The easy way is to switch for debian:buster, which is currently latest stable release of Debian. Packages on stable releases are changed rarely (bullseye is unstable).

The hard way is to get packagessources from additional dedicated repositories and then install or build them from source. For example https://deb.sury.org/ has any version of PHP. If you add it to apt, you can select which PHP you want to install.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...