-
Notifications
You must be signed in to change notification settings - Fork 2k
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 driver] - Adding support for sysctl and ulimit configuration #2501
Conversation
samber
commented
Mar 29, 2017
•
edited
Loading
edited
5cebee5
to
54cc9e2
Compare
client/driver/docker.go
Outdated
@@ -142,6 +142,10 @@ type DockerDriverConfig struct { | |||
PortMapRaw []map[string]int `mapstructure:"port_map"` // | |||
PortMap map[string]int `mapstructure:"-"` // A map of host port labels and the ports exposed on the container | |||
Privileged bool `mapstructure:"privileged"` // Flag to run the container in privileged mode | |||
SysctlsRaw []map[string]string `mapstructure:"sysctls"` // |
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.
think the mapstructure here should be sysctl
(singular) like all the other keys
client/driver/docker.go
Outdated
@@ -142,6 +142,10 @@ type DockerDriverConfig struct { | |||
PortMapRaw []map[string]int `mapstructure:"port_map"` // | |||
PortMap map[string]int `mapstructure:"-"` // A map of host port labels and the ports exposed on the container | |||
Privileged bool `mapstructure:"privileged"` // Flag to run the container in privileged mode | |||
SysctlsRaw []map[string]string `mapstructure:"sysctls"` // | |||
Sysctls map[string]string `mapstructure:"-"` // The sysctl custom configurations |
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.
singular here too(?)
client/driver/docker.go
Outdated
@@ -142,6 +142,10 @@ type DockerDriverConfig struct { | |||
PortMapRaw []map[string]int `mapstructure:"port_map"` // | |||
PortMap map[string]int `mapstructure:"-"` // A map of host port labels and the ports exposed on the container | |||
Privileged bool `mapstructure:"privileged"` // Flag to run the container in privileged mode | |||
SysctlsRaw []map[string]string `mapstructure:"sysctls"` // | |||
Sysctls map[string]string `mapstructure:"-"` // The sysctl custom configurations | |||
UlimitsRaw []map[string]string `mapstructure:"ulimits"` // |
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.
and here?
client/driver/docker.go
Outdated
SysctlsRaw []map[string]string `mapstructure:"sysctls"` // | ||
Sysctls map[string]string `mapstructure:"-"` // The sysctl custom configurations | ||
UlimitsRaw []map[string]string `mapstructure:"ulimits"` // | ||
Ulimits []docker.ULimit `mapstructure:"-"` // The ulimit custom configurations |
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.
and here?
Is there is reason this must be docker specific? It'd be nice if was supported for all drivers (or at least exec/other containers), xref: #2352 |
afb7ca9
to
cf248e6
Compare
@jippi I made some fixes CI does not pass, I think it's due to master branch |
cf248e6
to
175646e
Compare
175646e
to
26ffff7
Compare
rebased, CI passing |
I would agree with @ashald on this. If you're going to do it for container's at the least, you should do it for rkt as well. Not to mention other drivers would be benefit from this. |
Hey all, we are looking into adding a new stanza so this can be abstracted to all relevant drivers in 0.6.0. There won't be much activity on this PR until we have that design finalized. |
Any news on this @dadgar regarding the design of the sysctl stanza ? Not being able to configure somaxconn params and the like is a show stopper for production use |
If I can help in any way, just let me know ;) |
Hello @dadgar, any update on this issue? Do you now know what this generic stanza would look like? We are ready to work on a PR as soon as we have this information. We are really looking for this feature :) |
Hey, |
Hey @dadgar any news on this ? Thanks |
will as an example redis expect |
Hi @jippi, no it doesn't, if I start my container in privileged mode and run |
@commarla thats fine and expected, but what will the behaviour be if you start the container in non-privileged mode? just silently ignored? |
@jippi it fails with an error
|
same behaviour if you do like below?
|
I don't understand. |
yes, my question is, what will the behaviour be once this PR is merged in, when providing |
Ok the result should be the same than running this command
docker only allow whitelisted sysctls options, see at the end of this page https://docs.docker.com/engine/reference/commandline/run/#configure-namespaced-kernel-parameters-sysctls-at-runtime With a whitelisted sysctl it works:
|
great - couldn't be happier with this PR then :) |
How about merging this as is and create a second PR with rkt support later? |
We're using |
Closing this in favor of #3568 where I rebased and fixed merge conflicts. That PR preserves commit history |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |