Skip to content

FROM ... AS <name> clarification #26212

Description

@shealen-greencitizen

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Clarification

Description

The last line of the following example snippet may confuse some beginners:

FROM ubuntu AS base
RUN apt-get update && apt-get install -y shared-tooling

FROM base AS dev
RUN apt-get install -y dev-tooling

FROM base AS prod
COPY --from=build /app /app

as there is no named build stage in the snippet. I understand that it can merely be assumed such a stage exists, but since the prod stage is built from the base base image, it takes a second to comprehend there were merely omitted steps.

Location

https://docs.docker.com/reference/dockerfile/

Suggestion

Although a bit more verbose, it would perhaps be clearer to have something along the lines of:

FROM ubuntu AS base
RUN apt-get update && apt-get install -y shared-tooling
RUN mkdir /app && touch base.txt

FROM base AS dev
RUN apt-get install -y dev-tooling

FROM base AS prod
COPY --from=base /app /app

in which everything is explicit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions