-
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
Fix volumes-from/bind-mounts passed in on start #9631
Fix volumes-from/bind-mounts passed in on start #9631
Conversation
7f47e7d
to
432bd17
Compare
ping @jfrazelle @crosbymichael |
if path, exists := m.container.Volumes[m.MountToPath]; exists { | ||
// If this is a bind-mount/volumes-from, maybe it was passed in at start instead of create | ||
// We need to make sure bind-mounts/volumes-from passed on start can over-shadow non-binds | ||
// FIXME: This is a hack until HostConfig on container start is totally unsupported |
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.
You cannot say this and we need to revert the docs that say that this is deprecated as this is not the case and will not be deprecated. For the longest time this has been the only way of passing binds and volumes and so many third party clients use this as there was no other way.
1665254
to
b9ad32f
Compare
Fixed that wording. |
Thanks, I'm doing some testing now |
@@ -61,12 +61,6 @@ You can set the new container's MAC address explicitly. | |||
**New!** | |||
Volumes are now initialized when the container is created. |
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.
Maybe makes sense to specify somewhere that this volumes will be shadowed by start options.
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.
+1
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.
Can you please at least ping docs when stuff like this comes up? I have no way of discovering issues like this in a timely manner otherwise.
if !m.volume.IsBindMount && m.from == nil { | ||
return nil | ||
} | ||
if m.volume.Path == path { |
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.
What does this line mean?
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.
This is checking if the path of the passed in volume is the same as the path in container.Volumes.
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.
But why are you checking for this and returning?
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.
Because if it's the same then we don't need to do anything.
Same path means the same volume as there is only 1 volume object per path.
FYI, I tested this and it has fixed my issues I've seen with 1.4 |
@ibuildthecloud thanks for testing |
} | ||
|
||
if err := container.applyVolumesFrom(); err != nil { |
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.
Add a comment explaining that this will reset the volumesfrom hostconfig each time and that this is needed in order for start
to override what was set in create
.
b9ad32f
to
01becdc
Compare
@@ -61,12 +61,6 @@ You can set the new container's MAC address explicitly. | |||
**New!** | |||
Volumes are now initialized when the container is created. | |||
|
|||
`POST /containers/(id)/start` |
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.
In the PR's first comment, it'd be great to add a reference to the PR that is being partially reverted. (#8683)
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.
Done.
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.
@cpuguy83 I don't see it
01becdc
to
d44c9f9
Compare
Updated. |
*new test and fixed an issue where that wasn't the case. |
@jfrazelle @LK4D4 I removed your LGTM since the code changed in the last revision |
@ibuildthecloud if you want to retest as well that would be awesome, if not no biggie :) |
I retested it with |
lftm |
Would it be too much to ask for a test in docker_api in integration-cli? |
@unclejack I see that there are three tests in this PR. |
I'm also adding the entire docker-py integration tests for the lib in #9676 for API tests not owned by us. |
LGTM |
LGTM, although the code is very complicated to read :( |
…_start Fix volumes-from/bind-mounts passed in on start
Fixes #9628