Skip to content

Commit ad50426

Browse files
author
saville
committed
Use alternative method for systemd v248
1 parent b936491 commit ad50426

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

buildrunner/docker/runner.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,18 @@ def start(
174174
security_opt = None
175175
command = shell
176176
tmpfs = {}
177+
cgroupns = None
177178
if systemd:
178179
# If we are running in a systemd context, the following 3 settings are necessary to
179180
# allow services to run.
180-
volumes[
181-
"/sys/fs/cgroup"
182-
] = f"/sys/fs/cgroup:{'rw' if systemd_v248 else 'ro'}"
183-
security_opt = ["seccomp=unconfined"]
184-
command = "/usr/sbin/init"
185181
if systemd_v248:
182+
volumes["/sys/fs/cgroup/buildrunner.scope"] = "/sys/fs/cgroup:rw"
186183
tmpfs["/run"] = ""
184+
cgroupns = "host"
185+
else:
186+
volumes["/sys/fs/cgroup"] = "/sys/fs/cgroup:ro"
187+
security_opt = ["seccomp=unconfined"]
188+
command = "/usr/sbin/init"
187189

188190
if volumes:
189191
for key, value in volumes.items():
@@ -231,6 +233,7 @@ def start(
231233
cap_add=cap_add,
232234
privileged=privileged,
233235
tmpfs=tmpfs,
236+
cgroupns=cgroupns,
234237
),
235238
}
236239
if entrypoint:

0 commit comments

Comments
 (0)