Difference Between --Cap-Add=Net_Admin and Add Capabilities in .Yml

Docker-Compose: order of cap_drop and cap_add?

After diving around the moby source code, I finally located TweakCapabilities(): it takes the two sets of capabilities to add and to drop, enforcing the following scheme below; thus works in docker-compose.yaml where YAML doesn't define an order for the cap_add and cap_drop keys. The first matching item below will terminate the list.

  • container is privileged: true: ignore cap_add and cap_drop completely, return all available capabilities instead.
  • both cap_add and cap_drop are empty: return the default Docker set of capabilities.
  • cap_add contains ALL: return all capabilities minus the capabilities listed in cap_drop (ignores ALL in the latter).
  • cap_drop contains ALL: return the capabilities from cap_add only, ignoring any Docker default capabilities.
  • default: first drop all capabilites from the default set listed in cap_drop, then add the capabilities in cap_add, and finally return the result.

If I'm not mistaken this can be also represented in a more accessible manner as follows...

cap_add/cap_drop













privileged: true
ALL capabilities: ignores cap_add and cap_drop (boss mode)

Invoking iptables results in operation not supported in docker

Seems the error is to do with iptables. Big thanks to @KFC_ to investigating this.

Strangely when I ran it again from the python:3.7-slim image after installing iptables: I get extra output:

# iptables -t nat -nL
# Warning: iptables-legacy tables present, use iptables-legacy to see them
iptables: Operation not supported.

Found the solution here: https://github.com/docker/libnetwork/issues/2331

update-alternatives --set iptables /usr/sbin/iptables-legacy

FieldOperator class does not contain static Constants

The field operators are available as static properties of the Criteria class.
E.g.:

Criteria.GreaterThan
Criteria.Equal

etc.



Related Topics



Leave a reply



Submit