Best way to inherit from multiple Docker images

  docker, dockerfile

My OS is Ubuntu, but i want to grab very large components + dependencies from other, let’s say 3-4 base images.

All images that i need to derive from have, as i’ve mentioned, very large components + some dependencies.

Is there a way to incrementally build on an Ubuntu image, by copying stuff from other downloaded images ?

The most stupid think i can thing at the moment is to do it like this:

FROM my_base_1 AS base_1
FROM my_base_2 AS base_2
FROM ubuntu:18:04
COPY --from=base_1 relevant relevant_1
COPY --from=base_2 relevant relevant_2

apt-get install relevant-dependencies


Source: Docker Questions