1

On my own machine (Windows 10, Docker Desktop 2.1.0.3) the build succeeds and runs. On another machine (Ubuntu 18.04, docker CE 19.03.13) the build fails with the error shown.

Why does the build work on one machine but fail another?

dockerfile:

FROM ubuntu:latest AS toolchain
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
  build-essential \
  g++-5

error:

Package g++-5 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  gcc-10-test-results gcc-9-test-results gcc-8-test-results gcc-7-test-results

Package 'g++-5' has no installation candidate
The command '/bin/sh -c apt-get update && apt-get install -y   build-essential   g++-5' returned a non-zero code: 100

1 Answer 1

0

The problem seems to be that the ubuntu:latest image is stale. Changing to ubuntu:bionic fixes the issue:

FROM ubuntu:bionic AS toolchain
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
  build-essential \
  g++-5

I don't know why an old image is being used, but that seems like a separate question.

2
  • 2
    though this doesn't explain why it builds on one machine and not another. shouldn't both machines be running off the same base image and therefore encounter the same error in both?
    – Homan
    Jan 29, 2022 at 18:10
  • That's how it should work, but the ubuntu:latest image was not the same on the two machines. One of them had an older cached image an did not update to the later version.
    – Craig
    Feb 6, 2022 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.