docker build fails on one machine but succeeds on another 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 &amp;&amp; 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 &amp;&amp; apt-get install -y   build-essential   g++-5' returned a non-zero code: 100
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 &amp;&amp; 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.