Skip to content

Commit 995a0b7

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

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():
@@ -219,6 +221,7 @@ def start(
219221
"user": user,
220222
"working_dir": working_dir,
221223
"hostname": hostname,
224+
"cgroupns": cgroupns,
222225
"host_config": self.docker_client.create_host_config(
223226
binds=_binds,
224227
links=links,

0 commit comments

Comments
 (0)