How to create two images in one Dockerfile, they only copy different files.
Shouldn\'t this produce two images img1 & img2, ins
You can build multiple images from one Docker file by running docker build
for each build stage name
want to pick out of the Dockerfile (FROM alpine as name
).
By default docker builds the image from the last command in the Dockerfile, however you can target the build to an intermediate layer. Extending from the example Dockerfile in the question, one can:
docker build -t image1 --target img1 .
ref: https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target