3

I'd like to fix Git version used in my image to the 2.9.3.

However, when I run

RUN apt-get install git=2.9.3 -y

it doesn't work:

Version '2.9.3' for 'git' was not found

How to correctly specify Git version?

0

1 Answer 1

3

You need to specify a package version, not the upstream software version:

apt-get install git=1:2.9.3-1

You also need to make sure the package repositories you're using actually contain the version you're after. If you're using Debian for your base images, you can find the appropriate snapshot repository:

deb http://snapshot.debian.org/archive/debian/20160817T042105Z/ sid main

(based on the available snapshots of git 2.9.3-1).

7
  • 3
    Doesn't work: sudo apt-get install git=2.9.3-1 Reading package lists... Done Building dependency tree Reading state information... Done E: Version '2.9.3-1' for 'git' was not found Commented Sep 2, 2016 at 22:32
  • @Stephen How do we know the package version? For e.g. what's the package version for the latest 2.34.1?
    – Koder101
    Commented Dec 21, 2021 at 6:15
  • @Koder101 look at the available snapshots; the 2.34.1 package is version 1:2.34.1-1. Commented Dec 21, 2021 at 6:21
  • @StephenKitt Thanks. Since I am installing it under ubuntu-20.04 docker image, so the debian snapshot isn't valid there. When I did apt-cache madison git it gave me 1:2.25.1-1ubuntu3.2 which works fine. However, I wonder do we have the package snapshot for docker ubuntu images too?
    – Koder101
    Commented Dec 21, 2021 at 6:27
  • 1
    @Koder101 that’s an anti-pattern with Ubuntu-based images, because of the way the repositories are maintained: fixing the version with apt install will ensure you don’t get security updates for the packages whose versions are fixed. Commented Dec 21, 2021 at 8:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .