compose icon indicating copy to clipboard operation
compose copied to clipboard

Security option systempaths=unconfined unsupported by compose.

Open pborky opened this issue 4 years ago • 7 comments

Description

Running a service with an option security_opt: [ "systempaths=unconfined" ] yields following error:

Error response from daemon: invalid --security-opt 2: "systempaths=unconfined"

However, providing the same option to docker client (--security-opt systempaths=unconfined) works properly:

> docker run --rm  --security-opt systempaths=unconfined ubuntu ls /sys/firmware 
devicetree ftd

Steps to reproduce the issue: 1.

cat > docker-compose.yml << E
version: "3"
services:
  ls:
    image: ubuntu:latest
    command: "ls  /sys/firmware"
    security_opt: [ "systempaths=unconfined" ]
E
  1. docker compose run ls

Describe the results you received:

Error response from daemon: invalid --security-opt 2: "systempaths=unconfined"

Describe the results you expected:

devicetree ftd

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.5.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.2-docker)
  compose: Docker Compose (Docker Inc., v2.5.0)

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 6
 Server Version: 20.10.16
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.32-v7l+
 Operating System: Raspbian GNU/Linux 11 (bullseye)
 OSType: linux
 Architecture: armv7l
 CPUs: 3
 Total Memory: 7.714GiB
 Name: raspberrypi
 ID: LBW3:Z6MM:4JJR:4SOJ:E2FQ:HARU:WMQY:UZLQ:WNYB:Y4O4:IJM2:CDQZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No memory limit support
WARNING: No swap limit support

Additional environment details:

arch: armv7l

pborky avatar May 28 '22 01:05 pborky

@pborky Thanks for reporting this,

However, after looking at CLI, this option is sadly client-side only.

maxcleme avatar May 31 '22 09:05 maxcleme

Yes, to support this option, it looks like compose will have to implement something similar to the CLI (if the option is set, then some other options need to be updated). Possibly that logic could be moved to the daemon-side, but that may need some discussion (ISTR it was done on the client side for a reason, but I'd have to dig up those discussions)

thaJeztah avatar May 31 '22 11:05 thaJeztah

It doesn't seem to be fixed in 2.15.1, I tried Debian package and docker-compose-linux-aarch64 binary.

$ docker compose version
Docker Compose version v2.15.1
    security_opt:
      - systempaths:unconfined
[+] Running 0/1
 ⠸ Container 19f2cbea0d17_mqtt-client  Recreate                                                                                                                                                                                          0.3s
Error response from daemon: invalid --security-opt 2: "systempaths:unconfined"

goldyfruit avatar Jan 31 '23 14:01 goldyfruit

@goldyfruit the expected syntax is systempaths=unconfined (using equal sign) same as the --security_opt flag on docker run command

ndeloof avatar Feb 13 '23 09:02 ndeloof

@goldyfruit the expected syntax is systempaths=unconfined (using equal sign) same as the --security_opt flag on docker run command

Indeed, thanks!

goldyfruit avatar Feb 13 '23 23:02 goldyfruit

The Python docker-compose doesn't seem to support it though.

goldyfruit avatar Feb 15 '23 02:02 goldyfruit

@goldyfruit given that this is a new feature, and compose v1 (python implementation) is in maintenance mode (see https://github.com/docker/roadmap/issues/257), I don't expect this to arrive in v1. I'd recommend using compose v2, but if there are specific issues that prevent you from switching to v2, it's good to open a ticket for those (as the intent is for compose v2 to provide all capabilities that v1 has).

thaJeztah avatar Feb 15 '23 09:02 thaJeztah