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

# ...

Comments

No Comments Yet.
Be the first to tell us what you think.
Docker instructions
Docker instructions

Are you learning Docker ? Try our test we designed to help you progress faster.

Test yourself