Add VOLUME instruction to buildfile by crosbymichael · Pull Request #1124 · moby/moby

@crosbymichael

Add the VOLUME instruction to the Dockerfile builder.

FROM ubuntu
VOLUME ["/data"]

OR

FROM ubuntu
VOLUME /data

@shykes

Hey @crosbymichael, thanks for contributing this. Would you mind adding a test which makes sure that the built image does indeed expose a volume at the given path? Your test does verify that the keyword doesn't cause a build to fail, but that's currently the case for all keywords since they are ignored by default.

Happy to help, and looking forward to merging this.

@crosbymichael

Thanks for the feedback. Done!

@vieux

@shykes

1 similar comment

@creack

creack added a commit that referenced this pull request

Jul 12, 2013
+ Builder: Add VOLUME instruction to buildfile

@matthewmueller

Is volume host:container supported? Or volume [host:container]?

I wasn't able to get that working.

@crosbymichael

@matthewmueller

@crosbymichael should they be? It seems like an asymmetry between the CLI and the Dockerfile.

@crosbymichael

@matthewmueller

Oh good point, so it seems like VOLUME is more to serve volumes-from then because an empty volume inside a container isn't very useful

@wking wking mentioned this pull request

Dec 10, 2013