What instructions do you use in Dockerfile to a previous stage as a new stage?
Experience Level: Senior
Tags: Docker
Answer
Use FROM <source-stage> AS <new-stage>
Example:
FROM alpine:latest AS stage1
# ...
FROM stage1 AS stage2
# ...
FROM stage1 AS stage3
# ...
Related Docker job interview questions
How can you ensure that some files will be ignored by a build process and won't be copied as part of COPY instruction that is defined in a Dockerfile?
Docker SeniorWhat Docker instruction will you use to copy files from one layer to another layer when you are creating a Dockerfile?
Docker SeniorWhat is the LABEL instruction good for in Docker?
Docker SeniorWhat is a difference between COPY and ADD instructions in Docker?
Docker SeniorWhat is the ADD instruction good for in Docker?
Docker Senior