Uh oh!
There was an error while loading. Please reload this page.
docker run: specify cgroup namespace mode with --cgroupns - #2024
Conversation
AkihiroSuda
commented
Jul 30, 2019
Looks good, but CI failing |
f39912d to
b560da6CompareGordonTheTurtle
commented
Jul 30, 2019
Please sign your commits following these rules: $ git clone -b "1988-run-cgroupns-mode" git@github.com:rgulewich/cli.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842358791888editor openschange each 'pick' to 'edit'save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -fAmending updates the existing PR. You DO NOT need to open a new one. |
b560da6 to
bd828fdCompareCodecov Report
@@ Coverage Diff @@## master #2024 +/- ##
=========================================
Coverage ? 56.79% =========================================
Files ? 311 Lines ? 21849 Branches ? 0 =========================================
Hits ? 12410 Misses ? 8523 Partials ? 916 |
bd828fd to
0883b2aComparergulewich
commented
Jul 30, 2019
@AkihiroSuda - Fixed CI failures related to my changes - |
kolyshkin
commented
Jul 31, 2019
@rgulewich might be fixed by #2016, could you please rebase? |
0883b2a to
4c4bb53Comparergulewich
commented
Jul 31, 2019
@kolyshkin - That did it, thanks! |
| environment.SkipIfCgroupNamespacesNotSupported(t) | ||
| result := icmd.RunCommand("docker", "run", "--cgroupns=private", "--rm", fixtures.AlpineImage, | ||
| "sh", "-c", "[[ $(cat /proc/1/cgroup | grep memory | cut -d: -f 3) == '/' ]]") |
There was a problem hiding this comment.
Perhaps rewrite this to not depend on bash? Also, looks like a single grep is sufficient, e.g.
grep -q ':memory:/$' /proc/1/cgroup
4c4bb53 to
b6efc48Compare
thaJeztah
left a comment
There was a problem hiding this comment.
Thanks! left some comments inline
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| --cap-add value Add Linux capabilities (default []) | ||
| --cap-drop value Drop Linux capabilities (default []) | ||
| --cgroupns string Cgroup namespace to use | ||
| 'host': Run the container in the Docker host's cgroup namespace |
There was a problem hiding this comment.
Might be slightly easier to read if the descriptions are aligned;
--cgroupns string Cgroup namespace to use 'host': Run the container in the Docker host's cgroup namespace 'private': Run the container in its own private cgroup namespace '': Use the default Docker daemon cgroup namespace specified by the "--default-cgroupns-mode" option (default)Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| **--default-cgroupns-mode**="**host**|**private**" | ||
| Set the default cgroup namespace mode for newly created containers. The argument | ||
| can either be **host** or **private**. |
There was a problem hiding this comment.
Should we describe the default here as well?
| } | ||
| cgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode) | ||
| if !cgroupnsMode.Valid() { |
There was a problem hiding this comment.
Thinking about this; I'm a bit on the fence if we should validate this on the client side, or just leave it to the daemon to return an error if an invalid value was provided. OTOH, these values likely won't change in future, so perhaps it's ok
@kolyshkin wdyt?
There was a problem hiding this comment.
I think it's ok for now, given that it likely won't change in future, but I'll open a follow-up issue after this is merged to discuss this
albers
left a comment
There was a problem hiding this comment.
bash completion LGTM, thanks.
AkihiroSuda
commented
Aug 16, 2019
needs rebase |
2ea22b0 to
602452fCompare
thaJeztah
left a comment
There was a problem hiding this comment.
thanks for updating! (and sorry for the delay 😞) I left one comment about the docker-compose schema version (hoping #2073 will be merged soon), and a suggestion for the flag description output for --help.
Otherwise looks good to me!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| cgroupnsMode := container.CgroupnsMode(copts.cgroupnsMode) | ||
| if !cgroupnsMode.Valid() { |
There was a problem hiding this comment.
I think it's ok for now, given that it likely won't change in future, but I'll open a follow-up issue after this is merged to discuss this
602452f to
fdeb2fdComparergulewich
commented
Sep 10, 2019
@thaJeztah - Updated with your changes. Mind taking a look? |
977f2ad to
88aba22Compare88aba22 to
306338fComparergulewich
commented
Sep 30, 2019
@thaJeztah / @kolyshkin - Mind taking a look? Thanks! |
AkihiroSuda
commented
Oct 25, 2019
@thaJeztah PTAL? |
AkihiroSuda
commented
Oct 25, 2019
needs rebase |
306338f to
298d9cdComparergulewich
commented
Oct 25, 2019
Rebased. @thaJeztah, mind taking a look? |
298d9cd to
15c01bbCompare15c01bb to
5afc093CompareAkihiroSuda
commented
Jan 15, 2020
ping @thaJeztah |
5afc093 to
e0d3e04CompareSigned-off-by: Rob Gulewich <rgulewich@netflix.com>
e0d3e04 to
5ad1d4dCompareAkihiroSuda
commented
Feb 10, 2020
CI failure seems unrelated |
AkihiroSuda
commented
Feb 11, 2020
CI green |
thaJeztah
commented
Feb 11, 2020
Whoop! Let's merge! @AkihiroSuda if you're able to assist with #2303 (that's related to CI being really flaky currently) |
- What I did
This adds the
--cgroupns=host|privateoption todocker runto allow setting the cgroup namespace mode. Fixes#1988- How I did it
Largely by copying the code for userns and ipc modes.
- How to verify it
docker run --cgroupns=privateagainst a daemon that's running with--default-cgroupns-mode=host.- Description for the changelog
docker run: allow specifying cgroup namespace mode with --cgroupns
- A picture of a cute animal (not mandatory but encouraged)