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
Proposal: Add volume ls/inspect/rm/create commands #8484
Conversation
f143761
to
a10edf1
Compare
@cpuguy83 what is the default path for |
Same as creating a volume through "run -v", so |
@cpuguy83 oh thanks I didn't remebeer we changed this |
83f601d
to
d237b7d
Compare
@vieux That's actually not changed, or at least not changed in quite some time. |
d237b7d
to
fdf6503
Compare
@cpuguy83 this is cool. |
@zhgwenming Not really, because we are dealing with a collection of volumes. |
943a31a
to
e7171c8
Compare
I'd vote for using the singular, as in "docker volume" instead of "volumes". Most of the operations are on an individual volume, except "ls". (It's the same argument for why some people name database tables as plural vs. singluar) I'd actually prefer to have multiple top-level commands like "vol-create", "vol-delete", "vol-list", "vol-inspect", but that maybe too much like virsh for your liking. |
I would expect |
@tsutsu I sort of like the idea, but also feel it is somewhat surprising behavior. I think it falls into the realm of GC, which Docker does not handle itself at all right now. |
@cpuguy83 Could we have, as part of the information returned by "docker volumes inspect <volume_name>", the containers that are using this volume? |
@pchoco83 already there. |
@cpuguy83 I just saw the "Aliases" info, thanks! |
@cpuguy83 I compiled the docker binary from this branch in order to play with it. #docker volumes inspect test-volume #docker run -d -P --volumes-from test-volume:/etc/mysql tutum/mysql Is this option not implemented yet? |
@cpuguy83 I realized it works if using a "volume_alias" instead of the "volume_name". |
@pchico83 No. You can, however, use the name with |
@cpuguy83 Thanks! Is the "-v" option (using a volume name) available from the remote API? |
@pchico83 The docker CLI only ever uses the remote API, so yes :) |
@cpuguy83 Found it. Using "binds" when starting a container. Thanks! |
Only one process can manage the pool. This process knows the transaction Id and manages pool transaction Id. Two processes can't do it. |
Would such improvement be able to solve the other problem: that docker is not able to bind mount volumes into the container as a different |
W.r.t complexity of dm, btrfs etc, it is already managed by graphdriver and image and container objects already use it. So we probably will not be dealing with new complexity if we extend volumes to make use of graph drivers other then VFS. If extensions can't work on same pool where images and containers are stored, then it will not serve the use case I have been thinking of. Also I am wondering why volume has to be a path. Why could it not be an object with a unique hash ID (like images) and then various metadata attached to it. And path will be just one of the metadata. If user specifies the path, then user is sort of responsible to making sure that volume is up before it is used by docker. Otherwise, it could be a docker managed volume and path will be automatically determined by docker (/var/lib/docker/volumes/mnt/). Are there some patches somewhere for this extension based volume management. I want to play with it a bit and see what it will offer. |
The previous patch for docker volume driver I mentioned separates pool/working directory for image and volume management, since I found it caused conflict on e.g. devId allocation which is per DeviceSet in device mapper(which I allocated another DeviceSet for the volume in the patch). If we want to use the same pool, I guess there would be a little more work need to be done. However, the major problem still is, volume is assumed to be a directory currently, rather than an object. I don't think that assumption can hold in the future. We can keep path(as source and use vfs) for backward compatibility, but ultimately I think volume should be defined as: an object can be mounted to a path of guest container. Then we can do various things to the object. Since we're already planning to have separate volume commands for docker, it would be so natural to have the volume as an object rather than merely a path. I think it would be necessary for the new volume driver able to use graphdriver as volume driver, rather than only vfs and host mount in the future. |
+1 Absolutely. IMO (and I think I mentioned that on other issues) a volume is storage where and how that storage is manager should be of no concern for the container. In a simple configuration, a volume could be stored on the host, in a directory. On a more advanced setup, this could be a remote volume or "you name it". My ideal steps would be to (1) create/define a volume ("storage") using the desired driver. (2) connect the volume to the container. It should be possible to manage the volume separately, for example to migrate or snapshot a volume, but all these could be dependent on the driver and (again) transparent to the container. |
+1 to some of your ideas. Few thoughts.
Those are some of the ideas. I think if we maintain a summary document which describes new volume architecture, it will help a lot. |
Since this isn't really mergable today, it doesn't really make sense to keep it open, so I'm going to go ahead and close. So a lot of this discussion is really great, but is probably better suited for docker-dev ML at this point, so it would be really great to continue there, or even on IRC for specific questions. Thanks. |
I like this. |
@KodyKantor Some other bits of the code-base need to be handled first so this can be implemented with the suggested API. |
…mes. To clean up existing dangling volumes (more or less) safely, use https://github.com/chadoe/docker-cleanup-volumes.git, at least until moby/moby#8484 is tackled.
@cpuguy83 This issue is referenced from https://docs.docker.com/userguide/dockervolumes/:
Since this is closed, where can I go to check the progress on improving volume management? |
@laktak thanks for reporting; #14214 is a "tracking" issue for issues related to volume management. Are you perhaps interested in creating a pull-request to update the link in the documentation? The Markdown file that is used to generate that page in the documentation can be found here /docs/userguide/dockervolumes.md |
@thaJeztah The text has already been updated (not by me), it's just not live. |
I'm lost, was this functionality implemented or not? |
@ovidiub13 no, it's not implemented (yet); see #14214 |
@thaJeztah @ovidiub13 In fact the volume management has already been implemented by @cpuguy83 at #14242 . It's in review now and I suppose it would be merged in v1.9. |
@yasker yes, you're right; I intended to say "it's not merged yet" |
Thank you. I'm looking forward to that release. |
For those following this; this functionally is now implemented in #14242, which was just merged, and will be in docker 1.9 If you want to test it before that, nightly builds, build from master can be found at https://master.dockerproject.org |
docker volumes ls
- list all volumesCan be used with --filter dangling=true to list volumes not in use
docker volumes create
- create volumesCan set,
--name
,--path
,--mode
. Can also be used with noarguments to have everything auto generated
docker volumes rm <volume name>
- Remove a volumeVolumes in use by containers cannot be removed.
Bind-mounts cannot be removed. (May want to have a way to remove just
the bind-mount config. Else this does seem to cause issues with tests)
docker volumes inspect <volume name>
- Inspect a volume/get its configSupports
--format
just like container inspect.docker run
can be used to either call a volume by name asdocker run -v <volume name>:<mount point>
or withdocker run --volumes-from <volume alias>:<mount point>[:<mode>]
docker run -v <path>
will create a volume with a generated name, justas
docker volumes create
with no args.All existing APIs/UI will work as normal.
There is no breakage in these changes.
Implements Proposal #8363