-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Docker volume create should not be idempotent (by default) #16068
Comments
I'm inclined to leave this be. It is something can be changed if needed. In general I'm of the mindset that we should be pushing off the storage management to the storage backend. |
I think it would be much harder to deny now (i.e., report a conflict if a volume with that name exists), and "allow" it in the future than the other way around. For now, only checking for the volume name would be (I think) fairly easy to implement; if we decide to include "options" to the equation in future, designing a storage mechanism for those options can be postponed in the future. Again, I think an error on conflicting names would be consistent with other parts of Docker.
This will need modifications to all plugins, and could lead to inconsistent behavior (i.e., 'plugin A' does not error, whereas 'plugin B' does). |
There should be no modification of plugins. |
The existing functionality where idempotency is driven into the plugin works out pretty well. While I don't deny that what is being mentioned here would be a move in the right direction, it seems like a breaking change today. I believe to do what is mentioned it would be an updated plugin API and volume driver abstraction for versioning. Today even the IMO, |
I'm 👍 for this proposal. It is generally a bad idea to rely on such unexpected behavior. It doesn't give any benefits in my opinion, while might cause problems. If user is fine with the case that container might already exist - he should handle such situation explicitly. |
I agree with the proposal. As with any good rule there may be exceptions but in general, if I do any kind of docker "create" I expect a new thing to be created or an error generated. Returning me a previously create thing is not what I asked for. If we really want to support "conditional creates" then it should be explicitly asked for via some flag as I think that will not be the norm for most use cases. |
Agree -- I think the original functionality was just so that using a volume name on "run" would always give you the same volume, and "volume create" is just following the same code path. |
I agree. |
+1 to report errors when creating a same name volume, this "fail fast" can help a lot for administrating the docker volumes. |
It seems that this functionality has been this way for quite a while and nobody's world is ending, so it's probably not a big deal, but FWIW I would also expect a non-zero exit when a volume already exists, just as trying to |
So what's up with this one? It does create very confusing experience when customers feel the data is lost (when in reality an empty local volume is created on failure to communicate with a plugin) . |
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
in the compatibility layer, creating a volume with a name that already does not result in an error. instead a 201 response with the existing volume's information is returned. while it seems like a bug on the part of docker and they agree, no attempt has been made to fix it in five years. See moby/moby#16068 Fixes: containers#7740 Signed-off-by: baude <bbaude@redhat.com>
Bump. What about hiding the fail-fast behaviour behind a parameter? |
My reverse 2 cents, I was hoping this behaviour would be the case for a CD job to create the volumes if they're missing but no-op otherwise. For things like the |
This issue is to discuss the behavior of
docker volume create
for named volumes. I'd like to have consensus on this before the 1.9 release to prevent awkward, backward-compatibility breaking changes after that.Currently,
docker volume create --name foo
will create a volume if it doesn't exist, and will be a "no-op" if a volume with that name already exists.I think this behavior should be changed for a couple of reasons;
docker run --name foo
will fail if containerfoo
already exists)Example 1 - using the wrong volume
The user creates volume
dbdata
, and uses the volume for a containerAt a later stage, the user does the same (e.g. for a different project),
leading to the existing volume being used unknowingly; this can lead to data-loss if data in the existing volume is overwritten
Example 2 - using the wrong options
The user creates volume
myvol
with some optionsAt a later stage, creating a volume (using different options), will be silently ignored:
Note that it's currently not possible to detect that the options are not applied, because
docker volume inspect
does not return the options that were used to create the volume.The text was updated successfully, but these errors were encountered: