Skip to content

feat: Add support for --cap-drop#390

Open
ddl-ebrown wants to merge 1 commit into
GoogleContainerTools:mainfrom
ddl-ebrown:add-support-for-cap-drop
Open

feat: Add support for --cap-drop#390
ddl-ebrown wants to merge 1 commit into
GoogleContainerTools:mainfrom
ddl-ebrown:add-support-for-cap-drop

Conversation

@ddl-ebrown

@ddl-ebrown ddl-ebrown commented Oct 24, 2023

Copy link
Copy Markdown

FYI - make test fails against the head of the main branch on my M1 -- which I didn't have time to diagnose. I'm using CI to verify that the tests behave properly.

@google-cla

google-cla Bot commented Oct 24, 2023

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ddl-ebrown ddl-ebrown force-pushed the add-support-for-cap-drop branch from 7af0286 to b109714 Compare October 24, 2023 18:21
@ddl-ebrown ddl-ebrown marked this pull request as ready for review October 24, 2023 18:22
@ddl-ebrown ddl-ebrown changed the title Add support for --cap-drop feat: Add support for --cap-drop Oct 26, 2023
@loosebazooka

Copy link
Copy Markdown
Member

uh, sorry no one looked at this, I get to spend a little time now and then trying to maintain this, if you can rebase this and update it, I can merge it in.

 - Support for --cap-add was added as part of
   GoogleContainerTools#327

 - This rounds out the feature set to also include support for
   --cap-drop

 - Updates tests to drop "chown" capability and verify doing so works

 - closes GoogleContainerTools#389
@ddl-ebrown ddl-ebrown force-pushed the add-support-for-cap-drop branch from b109714 to e3c9a68 Compare February 29, 2024 15:06
@ddl-ebrown

Copy link
Copy Markdown
Author

@loosebazooka updated

@ddl-ebrown

Copy link
Copy Markdown
Author

Looks like we've got failing tests

FAIL: Run options (capabilities, bindMounts) test case failed

Will take a closer look

thomasdesr added a commit to anyscale/container-structure-test that referenced this pull request Jun 30, 2026
When reconciling cap-drop (GoogleContainerTools#390) with the API-compat change (GoogleContainerTools#538), hostConfig
set HostConfig.Capabilities = CapAdd alongside CapAdd/CapDrop. On Docker API
>=1.40 the Capabilities field is mutually exclusive with CapAdd/CapDrop, so the
daemon ignored CapDrop and dropped capabilities (e.g. chown) were not actually
removed -- failing the 'Test Capabilities containerRunOptions' integration test.
Drop the legacy Capabilities field; CapAdd (the GoogleContainerTools#538 fix) still makes caps work
on modern daemons. Pre-1.40 daemons (Docker <19.03) are not supported.
thomasdesr added a commit to anyscale/container-structure-test that referenced this pull request Jun 30, 2026
…stable

The containeropts fixture set privileged:true alongside drop_capabilities:[chown]
and excludedOutput .*chown.*. A privileged container receives the full capability
set, so cap-drop is overridden and chown is always present -- the assertion could
never pass (the upstream GoogleContainerTools#390 author had flagged this exact test failing). Remove
privileged so cap-add (sys_admin) and cap-drop (chown) are exercised as intended.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support to containerRunOptions for --cap-drop

2 participants