3

Is there a possibiliity to name a build-stage? I am searching something like the following example:

ARG NAME

FROM python:3.7-alpine as modul-${NAME}
# ...

If I try this example this error occurs:

Error response from daemon: Dockerfile parse error line 5: invalid name for build stage: "modul-${NAME}", name can't start with a number or contain symbols

I also tryed to use the argument as tag (modul:${NAME}) with the same result.

Wie
  • 422
  • 4
  • 20

1 Answers1

1

You can do this with BuildKit, which requires docker 18.09+. (https://docs.docker.com/develop/develop-images/build_enhancements/)

All you have to do is set an env variable before building:

DOCKER_BUILDKIT=1 docker build -t whatever .

I don't think it's possible without BuildKit.

user3534080
  • 1,201
  • 1
  • 14
  • 21