David Doria
David Doria

Reputation: 10273

How to create a volume from a local path in a Dockerfile?

With command line arguments, I can indicate that I want to mount a local directory as a volume:

docker run -i -t -v /path/to/directory/:/mount/point testimage

However, I can't find anything to describe the syntax to VOLUME in a Dockerfile to do the same thing. Can anyone explain what this looks like?

Upvotes: 3

Views: 3242

Answers (1)

user2105103
user2105103

Reputation: 13095

Dockerfiles only define the right side (which paths within the container are volumes) -- not the local/left side.

The mapping is done during container creation, not image creation.

Upvotes: 3

Related Questions