File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed
Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 1+ .DS_Store
Original file line number Diff line number Diff line change @@ -3,7 +3,28 @@ services:
33 build :
44 context : docker
55 dockerfile : Dockerfile
6- privileged : true
6+ # Instead of privileged: true, grant only the minimum privileges required
7+ # to run BuildKit and iptables. This avoids granting full device access
8+ # and unrestricted /sys write permissions that privileged mode includes.
9+ #
10+ # BuildKit OCI worker requires SYS_ADMIN for mount, namespaces, and cgroups.
11+ # iptables and CNI networking require NET_ADMIN.
12+ # runc needs SYS_PTRACE to access /proc/PID/ns/mnt for mount namespace setup.
13+ cap_add :
14+ - SYS_ADMIN
15+ - NET_ADMIN
16+ - SYS_PTRACE
17+ # BuildKit/runc needs syscalls (mount, unshare, pivot_root) blocked by
18+ # default seccomp and AppArmor profiles.
19+ security_opt :
20+ - seccomp=unconfined
21+ - apparmor=unconfined
22+ # Share the host's cgroup namespace so BuildKit can manage cgroups for
23+ # build containers. The volume mount makes /sys/fs/cgroup writable
24+ # (read-only by default in non-privileged containers).
25+ cgroup : host
26+ volumes :
27+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
728 ports :
829 - " ${PORT:-1234}:1234"
930 environment :
Original file line number Diff line number Diff line change 11services :
22 builder :
33 image : ${BUILDCAGE_IMAGE}:${BUILDCAGE_VERSION:-1}
4- privileged : true
4+ # Instead of privileged: true, grant only the minimum privileges required
5+ # to run BuildKit and iptables. This avoids granting full device access
6+ # and unrestricted /sys write permissions that privileged mode includes.
7+ #
8+ # BuildKit OCI worker requires SYS_ADMIN for mount, namespaces, and cgroups.
9+ # iptables and CNI networking require NET_ADMIN.
10+ # runc needs SYS_PTRACE to access /proc/PID/ns/mnt for mount namespace setup.
11+ cap_add :
12+ - SYS_ADMIN
13+ - NET_ADMIN
14+ - SYS_PTRACE
15+ # BuildKit/runc needs syscalls (mount, unshare, pivot_root) blocked by
16+ # default seccomp and AppArmor profiles.
17+ security_opt :
18+ - seccomp=unconfined
19+ - apparmor=unconfined
20+ # Share the host's cgroup namespace so BuildKit can manage cgroups for
21+ # build containers. The volume mount makes /sys/fs/cgroup writable
22+ # (read-only by default in non-privileged containers).
23+ cgroup : host
24+ volumes :
25+ - /sys/fs/cgroup:/sys/fs/cgroup:rw
526 ports :
627 - " ${PORT:-1234}:1234"
728 environment :
You can’t perform that action at this time.
0 commit comments