0

I have a need to install gcc-10 inside a very specific very old 18.04 docker image.

What happens is that the gcc-10 package is simply not found by apt.

When using the standard procedure involving add-apt-repository ppa:ubuntu-toolchain-r/test, the output in the offending docker build shows as:

#11 [builder  8/58] RUN add-apt-repository ppa:ubuntu-toolchain-r/test
#11 sha256:986838b1775ab762834c16c4e7b70e341339109cd31b0b06b587dd05202f0842
#11 0.809  Toolchain test builds; see https://wiki.ubuntu.com/ToolChain
#11 0.809 
#11 0.809  More info: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
#11 3.106 Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
#11 3.106 Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
#11 3.107 Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
#11 3.108 Hit:4 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
#11 3.109 Hit:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
#11 3.228 Get:6 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu lunar InRelease [23.8 kB]
#11 3.697 Get:7 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu lunar/main amd64 Packages [9892 B]
#11 3.710 Fetched 33.7 kB in 1s (52.6 kB/s)
#11 3.710 Reading package lists...
#11 DONE 4.4s

In a clean test run on the upper base image of this image, and the vanilla 18.04 image, the corresponding output of this part (which continues on to find gcc-10 just fine) is:

#10 [6/8] RUN add-apt-repository ppa:ubuntu-toolchain-r/test
#10 sha256:0712dfeb0955c88daac2c4b7efbb1f9f17f0d5e32eb738745e2506a8e5284504
#10 0.941  Toolchain test builds; see https://wiki.ubuntu.com/ToolChain
#10 0.941 
#10 0.941  More info: https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
#10 1.733 Hit:1 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
#10 1.775 Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
#10 1.785 Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
#10 1.794 Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
#10 1.837 Hit:5 http://security.ubuntu.com/ubuntu bionic-security InRelease
#10 1.838 Get:6 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic InRelease [20.8 kB]
#10 2.316 Get:7 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic/main amd64 Packages [50.4 kB]
#10 2.483 Fetched 71.1 kB in 1s (88.5 kB/s)
#10 2.483 Reading package lists...
#10 DONE 3.2s

As you can see, the problematic behavior is associated with a mention of lunar and no errors.

I'm curious what could cause this, and as an apt illiterate I'd like to get suggestions on what I can do to force it to fetch it for bionic because I feel like I can get past the issue of getting gcc-10 installed if I can change this. The days of this particular docker image are numbered of course so I don't need a super robust solution.

Meanwhile I can do something else like make use of gcc-10 in a multistage docker approach, obtaining and using it in a separate vanilla docker image and then bringing artifacts in, but I think there may be a simple apt-related solution here.

Steven Lu
  • 182

1 Answers1

0

Solved via suggestion here (dockerfile snippet, testing, probably don't make each command its own layer)

RUN add-apt-repository ppa:ubuntu-toolchain-r/test
RUN ls -la /etc/apt/sources.list.d/
RUN cat /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-lunar.list
RUN sed 's/lunar/bionic/' /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-lunar.list > /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-bionic.list
RUN cat /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-bionic.list
RUN apt-get update
Steven Lu
  • 182