8000 Add --cap-add as and --cap-drop to swarm services by alex-berger · Pull Request #26849 · moby/moby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

alex-berger
Copy link

Fixes #25885

This PR adds Linux capabilities support to Docker Swarm services.
Having this in place we can now use capabilities in the following CLI calls respectively in the corresponding API calls.

  • docker service create
  • docker service update

Signed-off-by: Alexander Berger alex-berger@gmx.ch

Fixes moby#25885

Having this in place we can now use capabilities in the following CLI calls respectively in the corresponding API calls.
- docker service create
- docker service update

Signed-off-by: Alexander Berger <alex-berger@gmx.ch>
@alex-berger
Copy link
Author

The corresponding PR for swarmkit is here moby/swarmkit#1565, once it has landed I will update the vendoring for swarmkit.

Copy link
Member
@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @alex-berger. This PR needs some more discussion. Also, to allow the option of having mixed-platform (Linux/Windows/Solaris?) Swarms, we should discuss if this option (which is Linux specific) should be copied 1-on-1 from the docker run syntax, or if we need a more "generic" concept /cc @stevvooe @aluzzardi @justincormack

Options:
--args string Service command args
--cap-add Add Linux capabilities (default [])
--cap-drop Drop Linux capabilities (default [])
Copy link
Member
@thaJeztah thaJeztah Sep 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work; the service update command allows you to specify the diff / changes, compared to the current service specification, so if we use the current convention; this would become --cap-add-add, --cap-add-rm, and --cap-drop-add, --cap-drop-rm, which would be really confusing.

We need to come up with different naming for this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me as user it's OK to have --cap-add-add, because it express exact the intention to add or remove something to or from --cap-add. Another name I can think of is like --cap-extra-add/--cap-extra-rm. Or --cap-include-add/--cap-include-rm and --cap-exclude-add/--cap-exclude-rm.

@justincormack
Copy link
Contributor

I don't really like the current --cap-add --cap-drop interface to be honest. I have a plan to give you the ability to change the default set on the daemon settings (in particular there is one capability that is problematic and many people should drop). But this means that the meaning of the add/drop commands changes, as you will get a different set depending on the daemon settings. I think it is better long term if we switch to a --capabilities interface which says which you actually need, even if you might get more by default for compatibility.

So I don't think we should add the interfaces as is to Swarm mode.

@alex-berger
Copy link
Author

I would be very pleased if someone could shed a light on the vision/plans for Docker Swarm Services. What are the goals and non-goals?
Docker Containers have been a great tool for us, services seem to be the logical evolution (gaining high availability and scale out). From experience I know that with portability one often loses all the important features, therefore I am really curious how Docker will approach portability (mixed-platform).

If it won't fit well with the overall vision for Docker Swarm I will then gladly close this PR.

@thaJeztah
Copy link
Member

From experience I know that with portability one often loses all the important features

Yes, that's an issue, and one that should be addressed (we don't want to end up with completely "dumbing down" services, if not all platforms support a feature)

If it won't fit well with the overall vision for Docker Swarm I will then gladly close this PR.

I think it's ok to keep it open for now, for discussion. I agree that some goals/guidelines should be written for this. We do want to move forward, but at the same time prevent implementing features "because we can", and regretting that decision later (deprecating features is far more complicated than adding them).

@justincormack
Copy link
Contributor

My understanding is that mixed platform will be supported, but that should not mean dumbing down, so the swarm should do its best to find somewhere it can run your job that requires a particular OS, device (eg we have requests for GPU hardware), or privileges.

However we don't want to carry over interfaces that could be improved as it is a good opportunity for some judicious revision of interfaces.

@errordeveloper
Copy link
Contributor

@justincormack we need this. I agree that explicit --capabilities flag would be much better. Are you suggesting that in order to add --capabilities we need a some changes in the Docker daemon first? If so, did you or anyone start working on that already, or you could outline the work that will need to be done for that?

@justincormack
Copy link
Contributor

@errordeveloper I had an idea about this on the way back from the Docker Summit, so am working on this.

@thaJeztah
Copy link
Member

@justincormack should we close this PR while you're working on an alternative?

@justincormack
Copy link
Contributor

Yes, am making some progress, we can always reopen.

On 13 Oct 2016 6:30 p.m., "Sebastiaan van Stijn" notifications@github.com
wrote:

@justincormack https://github.com/justincormack should we close this PR
while you're working on an alternative?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#26849 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAdcPMvtjnjjPfsh77H3JBV-uOZro_cmks5qzmrIgaJpZM4KEq0J
.

@thaJeztah
Copy link
Member

Ok, let's close this PR for now. Thanks @alex-berger!

@thaJeztah thaJeztah closed this Oct 13, 2016
@tlvenn
Copy link
tlvenn commented Oct 27, 2016

Hi @justincormack , any chance to update us on the progress on this front ? Thanks !

@RRAlex
Copy link
RRAlex commented Mar 8, 2017

Any roadmap on fixing the capabilities support regression on Linux?

For example we have a container requiring CAP_NET_ADMIN and it's impossible to run on swarm...

EDIT: Is there a way for a daemon to not disable certain capabilities by default? (Globally, not per container)
That would temporarily solve the problem.

@skygragon
Copy link

Is there a work around to enable some caps during 'service create'?

@AkihiroSuda
Copy link
Member

@justincormack @thaJeztah can we reopen this PR?

As we already have been supporting bind-mounting arbitrary path including docker.sock, I don't see any security degradation in this PR.

@thaJeztah
Copy link
Member

@AkihiroSuda I can reopen, but this will probably have to be reimplemented to use --capabilities in stead of "diffing" (CapAdd / CapDrop) with the default capabilities; similar to #36644.

@AkihiroSuda do you want to work on this / carry that?

@thaJeztah thaJeztah reopened this Oct 31, 2018
@alex-berger
Copy link
Author

FYI, I do not intend to restart working on this PR as I no longer have any need for this Swarm feature.

@thaJeztah
Copy link
Member

@alex-berger no worries; thanks for the update, and thanks for starting the work on this 👍

@Ryanauger95
Copy link

Hi, is there any update on this? We have a VPN that needs NET_ADMIN permissions and another server than needs NET_RAW, and we can't run these on stack deploy.

@purplesrl
Copy link

+1 @justincormack should continue the great work he started in 2016.

@thaJeztah
Copy link
Member

Work is continued in #38380 (thanks @olljanat!), so closing this one.

Thanks for starting the work on this @alex-berger !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0