Proposal: Container device add/remove CLI/API documentation#8826
Proposal: Container device add/remove CLI/API documentation#8826imain wants to merge 1 commit intomoby:masterfrom
Conversation
|
In response to #8348 I have created this PR. @shykes, @crosbymichael, @timthelion, @ibuildthecloud, @calfonso, @ewindisch, see what you guys make of it. I almost hate to bring it up but we should also decide if it's a good idea to update the hostConfig with changes to the container. |
There was a problem hiding this comment.
Rather than having an "arguments" paramater, why not have "host-path", "container-path" and "permissions" parameters separately?
There was a problem hiding this comment.
This is the format that 'ParseDevice' expects so it's actually easier to pass it in as the string. We could break it up though if that makes more sense long term. Right now we're relying on the format matching the internal parsing.
There was a problem hiding this comment.
I disagree with that claim. I specifically placed ParseDevice on the client side to make it so we never see the command line syntax as a "native" format. You shouldn't be using ParseDevice anywhere but rather directly creating a DeviceMapping https://github.com/docker/docker/blob/f98a1f1f7d9b3ef10c13fc3b6438c978b4d6aa78/runconfig/hostconfig.go#L31 struct as we store in the hostconfig. https://github.com/docker/docker/blob/master/runconfig/hostconfig.go#L54
Having multiple arguments is easier for people writting clients to the API. We don't want anyone worying about escaping the : character.
There was a problem hiding this comment.
OK cool, I will update this, thanks @timthelion. I'm at the openstack summit so I'm a bit slow to respond.
|
As for writing to the host config, I am personally undecided. To me "/dev/sdb" is not a thing. It is a temporary name. Almost a pronoun of sorts. There is a reason why the ubuntu folks decided to make the move to using UUIDs in |
|
However, I think that devices added with |
|
What is the behavior with |
|
needs a man page entry too :) |
|
@SvenDowideit , yeah yeah, there is also no implementation ;). This PR is ---------- Původní zpráva ---------- " needs a man page entry too :) — "= |
|
From a UX perspective, also note the issue I created on consistent naming/format for the CLI (and API); #8829 |
|
ah, roger, changing the title to reflect that. |
|
@timthelion Yeah I'm not sure on the hostConfig either. I'll be spending some time with Eric Windisch soon so maybe we can come up with some reasonable answer. |
There was a problem hiding this comment.
"Modify a container's devices"?
|
@imain please take a look at this gist - https://gist.github.com/dims/0d1ac1a5598e0b8a72e0 i've an alternative API there |
7901d86 to
2d8532b
Compare
|
Thanks for the input @dims. I modified my proposal with input from your API. |
a4fd1b0 to
22ae192
Compare
|
OK, good discussion on IRC @dims. I'm going to steal your idea wholesale then; I like it. :) The new changes make a complete add/remove/list API and CLI that uses unique ID's for each device. We should be able to remove the device using only the ID as we store the information for removal in the AllowedDevices list for the container. |
|
@imain lgtm+1 |
|
@timthelion what do you think? |
|
Using Ids is a good idea. It is important, however, to understand that these Imagine a container has the following device mappings: And you do: The container still has read only permission to access Note 1: How are these device mapping Ids generated? If they are random, how |
|
@timthelion - the container is 'happy_bell' in the add case. Actually in remove we should probably specify the container. I was planning to do random IDs. We could do a deterministic hash.. we could even just use a hash of the in-container device name as that should be unique per-container. You know I hadn't considered the example above. That could be tricky as we'll have to go through the allowed devices and make sure there's not a second use for them. |
Devices add/remove/ls CLI and API documentation. This is being proposed as the new API and CLI to see how people like it. Co-Authored-By: Chris Alfonso <[email protected]> (github: calfonso) Docker-DCO-1.1-Signed-off-by: Ian Main <[email protected]> (github: imain)
22ae192 to
d47d2dc
Compare
|
Fixed remove and ls. |
|
When you go through the list of allowed devices looking for duplicates make maybe it would be better to not have ids for device mappings, but to refer |
|
@crosbymichael what do you think? |
|
+1 for this |
|
I'm +1 for the proposal, but I don't see us merging this anytime soon until we agreed on #8829. I'm going to close this for now, which does NOT mean we don't want this feature. We can always reopen it later. We know we've been slow on design discussions, and we are working on improving that bottleneck. Thanks for your contribution. |
|
+1 for this proposal |
|
+1 for this |
1 similar comment
|
+1 for this |
Device add/remove CLI and API documentation. This is being proposed as
the new API and CLI to see how people like it.
Co-Authored-By: Chris Alfonso [email protected] (github: calfonso)
Docker-DCO-1.1-Signed-off-by: Ian Main [email protected] (github: imain)