0

Question about Dockerfile command in this format: RUN --mount=....

From this website, I have a question: https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#example-cache-go-packages

How is it that a RUN command can work starting with dash characters without a command preceding it that is able to parse the -- option?

Example from site:

# syntax = docker/dockerfile:1.3
FROM ubuntu
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
RUN --mount=type=cache,target=/var/cache/apt --mount=type=cache,target=/var/lib/apt \
  apt update && apt-get --no-install-recommends install -y gc
djangofan
  • 28,471
  • 61
  • 196
  • 289
  • 1
    Check https://stackoverflow.com/a/59600552/4222206 – Queeg Oct 07 '21 at 21:34
  • yep, that link answers my question. – djangofan Oct 09 '21 at 00:20
  • 1
    Does this answer your question? [Docker run --mount make all files available in a different folder during RUN](https://stackoverflow.com/questions/59599736/docker-run-mount-make-all-files-available-in-a-different-folder-during-run) – hakre Apr 22 '22 at 21:09

0 Answers0