New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add volume api #14242
Add volume api #14242
Conversation
29a7147
to
3f81a20
Compare
description += fmt.Sprintf(" %-10.10s%s\n", cmd[0], cmd[1]) | ||
} | ||
|
||
description += "\nRun 'docker volume COMMNAD --help' for more information on a command." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sp COMMAND
And is it possible to omit the driver option when rm/inspect? Docker should know which volume used which driver when created? |
@yasker No, not really. |
@cpuguy83 I see, thanks. Just curious, would we have ability to create docker disposable volume through docker volume command? Like what I shown above, without "-d"? |
Without "-d" would just use the default driver, which is currently hard coded to the "local" driver. |
I see we have this and #13924, how much of the work from that one could be reused here? |
@jonasrosland They are completely different things. |
Perfect, thanks for the explanation! |
865fff0
to
bd32f23
Compare
Removed |
@cpuguy83 It's strange, seems github got a glitch. I once commented on old commit that the specifying of driver/name should be consistent across the commands. Now I cannot find it anywhere... In short, the create/rm/inspect should use same order/parameter for input driver and volume name. Now inspect/rm using [DRIVER] [NAME], but create use "--name [NAME] --driver [DRIVER]" I think they should all be: "--name [NAME]" with "--driver [DRIVER]" as optional. If DRIVER is first augment, it cannot be omitted. Something like this would be useful: docker volume create vol1 And without driver it would default to "local" as we discussed. I omitted the "--name" above because it's pretty required, but not the driver option. |
I agree with @yasker. The name should always be the first argument for every command and the driver should always be a flag. |
I agree as it is right here is not good (and really horrible to actually use as I've learned the last couple of days!). What I have now, just making some test/doc tweaks, is expecting a volume to be specified as |
Warning: the mapping "data:/data" in the volumes config for service "thumbor" is ambiguous. In a future version of Docker, it will designate a "named" volume (see moby/moby#14242). To prevent unexpected behaviour, change it to "./data:/data" Warning: the mapping "logs:/logs" in the volumes config for service "thumbor" is ambiguous. In a future version of Docker, it will designate a "named" volume (see moby/moby#14242). To prevent unexpected behaviour, change it to "./logs:/logs"
Here's an example warning this suppresses: > Warning: the mapping "conf/:/etc/nginx/conf.d/" in the volumes > config for service "web" is ambiguous. In a future version of Docker, > it will designate a "named" volume (see > moby/moby#14242). To prevent unexpected > behaviour, change it to "./conf/:/etc/nginx/conf.d/" This warning appears on Docker 1.8.2.
I have a use-case to DISABLE VOLUME tags inside Dockerfiles. For example let's say I'm automating the build and deployment of dev and feature branches and possibly QA. For these environments I want to be able to build a pre-existing postgres image that has my schema and testing data saved, and pushed to a public repository. When such pre-existing database images have VOLUME dockerfile instructions, I pretty much have to either copy and paste the dockerfile without the VOLUME directive OR create a data-only container, tag/commit and push (haven't tested this route). Both of these are not desireable for staging data solutions that you want to push to a docker repo. |
yes, this ^^ @coding2012; however, isn't it a separate issue? |
@coding2012 @kojiromike that's indeed not really related to this PR. See #8177 (and #3465) for a prior discussion on that. |
Warning: the mapping "elasticsearch/logging.yml:/etc/elasticsearch/logging.yml" in the volumes config for service "elasticsearch" is ambiguous. In a future version of Docker, it will designate a "named" volume (see moby/moby#14242). To prevent unexpected behaviour, change it to "./elasticsearch/logging.yml:/etc/elasticsearch/logging.yml"
What about volume export/import ? |
@omribahuni this is not implemented in docker and should be a concern of the volume driver itself. |
@cpuguy83 I was expecting docker to do that exactly, like |
@omribahumi For persistent data, the storage backend probably already has a solution for backing up data, probably much more efficiently than docker could, and if not running a container and manually backing up with tar/gzip is a simple/elegant solution. |
@cpuguy83 may be something we should document; i.e. using the plugin's tools, or how to do an export |
…onfig for service "webapp" is ambiguous. In a future version of Docker, it will designate a "named" volume (see moby/moby#14242). To prevent unexpected behaviour, change it to "./webapp:/webapp")
Thanks for implementing this! Makes handling volumes a whole lot easier. After reading through docs (and skimming comments here) I'm still unsure about the approach taken to seed data of named volumes. When creating containers with auto-created (anonymous) volumes, mounting a volume to an existing folder results in existing data to be copied from the image to the volume. This does not apply to host mounted volumes. What about named volumes? |
It appears named volumes are treated just like host mounted volumes. Anonymous volumes
Host mounted volumes
Named volumes
|
Warning: the mapping "project:/www" in the volumes config for service "nginx" is ambiguous. In a future version of Docker, it will designate a "named" volume (see moby/moby#14242). To prevent unexpected behaviour, change it to "./project:/www"
Fixed by moby/moby#14242
Posting this up here for discussion.
TODO:
docker volume rm
on a volume multiple times to remove.