Repository navigation
Do not hide user provided network mounts [v2] - #14613
Conversation
|
Looks like it needs a gofmt. |
acf092f to
97533e7
Compare
|
Fixed. |
|
can we do this when we create the mount points for those resources rather than afterwards? |
|
@calavera Can you point me to the code where the mount points are created ? Obviously I am map'ing the bind-mounts when we traverse them and then us the map to fix up the file to be mounted to the mount points. |
|
Yes, but we're not removing those mount points from the collection and we're going to end up adding duplicated destinations in https://github.com/docker/docker/blob/master/daemon/container.go#L1090-L1120. I wonder if we can combine both somehow. |
|
addresses #13152 |
|
@calavera @ewindisch Should the user provide the content for these files or docker daemon? If the files are set earlier in the container structure (container.HostsPath for example) then the content is overwritten by the daemon. |
|
@calavera Have a look a the previous pr #14529 and this code here: https://github.com/docker/docker/pull/14529/files |
|
oh man, sorry for all the back and forth. I think this PR is more correct, but it requires a small change. In the At the end, right now we have something like: [
exec.Mount{Destination: "/etc/resolv.conf", Source: "/foo"...},
exec.Mount{Destination: "/bar", Source: "/bar"...},
exec.Mount{Destination: "/etc/resolv.conf", Source: container.ResolvConfPath...},
]We want to not add the first |
97533e7 to
47d6234
Compare
|
@calavera Have a look now. |
|
I like it! @stefanberger what do you think about adding an integration test to make sure this works? |
There was a problem hiding this comment.
that == false can be better expressed with !container.trySetNetworkMount.
There was a problem hiding this comment.
I will changes this.
And since it seem it will make make it 'in', I'll add test cases as well. Thanks
1ef9100 to
5cce424
Compare
|
@calavera For some reason I cannot run 'make test' on my machine. Step 2 fails for me. I now added a test case. It is difficult to apply the 'read-only' parameter passed via -v to those individual files. In this aspect the previous PR (https://github.com/docker/docker/pull/14529/files) I think would allow the handling of this in a more elegant way. |
|
Tests seem to pass, but the code needs to be rebased. |
5cce424 to
72edf2f
Compare
|
Rebased. |
2d1b3d4 to
1f71dc8
Compare
|
LGTM |
There was a problem hiding this comment.
Sorry I'm being a stickler here, but there is no reason to use dockerCmdWithError here.
dockerCmd checks the error and fails the test automatically.
So unless the error needs to be inspected you should use dockerCmd.
There was a problem hiding this comment.
agreed, I think we already moved all other tests to dockerCmd.
1f71dc8 to
09334c9
Compare
Prevent the docker daemon from mounting the created network files over those provided by the user via -v command line option. This would otherwise hide the one provide by the user. The benefit of this is that a user can provide these network files using the -v command line option and place them in a size-limited filesystem. Signed-off-by: Stefan Berger <[email protected]>
09334c9 to
6bd389b
Compare
|
Looks like this is updated @cpuguy83 , and amazingly, CI is green :) |
|
LGTM @stefanberger make sure you ping us in the comments when you make updates! |
Do not hide user provided network mounts [v2]
|
Thanks. |
|
@stefanberger how does this work with the ':ro' specifier (-v file:/etc/hosts:ro)? What about if you do 'run --read-only'? |
|
@ewindisch See above: "It is difficult to apply the 'read-only' parameter passed via -v to those individual files. In this aspect the previous PR (https://github.com/docker/docker/pull/14529/files) I think would allow the handling of this in a more elegant way." |
|
@stefanberger right, I saw that. I think this breaks user expectations of what ':ro' should do. Also, --read-only will apply here when it does not apply to other volumes. Perhaps simply add new fields adjacent to the path variables which indicates if these should be mounted rw/ro? |
|
Sounds good to me. I'll add two test cases. |
|
@ewindisch @stefanberger should I apply the "impact/changelog" label here? If I understand correctly, there's a change in behavior here that people should be aware of (and needs a mention in the changelog)? |
|
@thaJeztah it's a new feature, so it could be useful for users to know of it. It doesn't otherwise change behavior. It allows specifying '-v somepath:/etc/hosts' which wasn't working previously. |
Prevent the docker daemon from mounting the created network files over
those provided by the user via -v command line option. This would otherwise
hide the one provide by the user.
The benefit of this is that a user can provide these network files using the
-v command line option and place them in a size-limited filesystem.
Signed-off-by: Stefan Berger [email protected]