0

This question has been asked previously here and here, but my question is slightly different. In particular, let's say I want to install the same git version on a machine as my machine. I first run sudo apt-cache policy git, which gives me:

  Installed: 1:2.32.0-1~ppa0~ubuntu20.04.1
  Candidate: 1:2.32.0-1~ppa0~ubuntu20.04.1
  Version table:
 *** 1:2.32.0-1~ppa0~ubuntu20.04.1 500
        500 http://ppa.launchpad.net/git-core/ppa/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
     1:2.25.1-1ubuntu3.1 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     1:2.25.1-1ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

I notice that the version is 2.32.0. If git were a Python package, with pip, I'd just do pip install git==2.32.0 to install it. But with apt-get, I have to do:

sudo apt-get install git=1:2.32.0-1~ppa0~ubuntu20.04.1

In particular, I have to specify 1:2.32.0-1~ppa0~ubuntu20.04.1. Is there no way to just specify that I want 2.32.0 without the other stuff?

EDIT: For some more context, I'm trying to create a Docker image with particular package versions. According to Docker docs, I should be able to do:

RUN apt-get update && apt-get install -y \
    package-bar \
    package-baz \
    package-foo=1.3.*

Notice the part package-foo=1.3.*. I tried this with git on my machine: sudo apt-get install git=2.32.* but I get:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '2.32.*' for 'git' was not found

while doing just sudo apt-get install git works

0 Answers0