1

From https://hub.docker.com/r/gitlab/gitlab-runner/dockerfile:

VOLUME ["/etc/gitlab-runner", "/home/gitlab-runner"]

I have read Understanding "VOLUME" instruction in DockerFile and docker volume and VOLUME inside Dockerfile, however, I still cannot figure why does this image specify these two paths as VOLUME.

Chen Li
  • 4,824
  • 3
  • 28
  • 55
  • I assume this maps each of these folders to identical folders in the container. However, it looks like from your answer link, a Docker container would still require host directories to be specified in the `docker run` command in order for it to work. – halfer Aug 05 '19 at 13:22

1 Answers1

0

The VOLUME command in the Dockerfile exposes these directories as VOLUMES. Meaning it will auto-create volumes on docker run to persist the data inside the container(s).

Since containers are suppose to be stateless you want to persistent configuration and e.g. build-cache on the host.

Stefan van Gastel
  • 4,330
  • 23
  • 25