With the support of the multi-stage builds, it has become convenient to maintain repos up to a point. But how can you extend these repos?
Up to now, you can build an image of a specific tag using the --target
in the docker build
command.
From docker-compose, you can use the target
entry in the context
entry to specify it.
In my case, I want to use an image from docker hub and extend a specific target. Right now, I am using a Dockerfile (which I call from docker-compose but that shouldn't matter) which has the
FROM repo/sample-name
DO my stuff
That repo has 3 targets in their Dockerfile named sample-name
, sample-name-full
which extends sample-name
and sample-name-dev
which extends sample-name-full
. The dashes in these names are just like the repo named their targets.
What seems to be happening is that I am getting the first target as the build target (or I think I do) which is named after the repo itself. How can I, let's say, extend the intermediate target?
I tried stuff like
FROM repo/sample-name:latest-sample-name-dev
etc but I could not make it work.