Skip to content

Commit dacb093

Browse files
author
jordanbreen28
committed
(Maint) - remove deb_family_system_volume
This commit removes any reference to deb_family_system_volume.
1 parent 9e728d3 commit dacb093

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

tasks/docker.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,7 @@ def provision(image, inventory_location, vars)
161161
warn '!!! Using private port forwarding!!!'
162162
front_facing_port = random_ssh_forwarding_port
163163
full_container_name = "#{image.gsub(%r{[\/:\.]}, '_')}-#{front_facing_port}"
164-
deb_family_systemd_volume = if (image =~ %r{debian|ubuntu}) && (image !~ %r{debian8|ubuntu14})
165-
'--volume /sys/fs/cgroup:/sys/fs/cgroup:ro'
166-
else
167-
''
168-
end
164+
169165
node = {
170166
'uri' => "#{hostname}:#{front_facing_port}",
171167
'config' => {
@@ -184,7 +180,15 @@ def provision(image, inventory_location, vars)
184180
node['vars'] = var_hash
185181
docker_run_opts = var_hash['docker_run_opts'].flatten.join(' ') unless var_hash['docker_run_opts'].nil?
186182
end
187-
creation_command = "docker run -d -it --privileged #{deb_family_systemd_volume} --tmpfs /tmp:exec -p #{front_facing_port}:22 --name #{full_container_name} "
183+
184+
unless docker_run_opts.nil?
185+
docker_run_opts += ' --volume /sys/fs/cgroup:/sys/fs/cgroup:rw' if (image =~ %r{debian|ubuntu}) \
186+
&& (docker_run_opts !~ %r{--volume /sys/fs/cgroup:/sys/fs/cgroup})
187+
docker_run_opts += ' --cgroupns=host' if (image =~ %r{debian|ubuntu}) \
188+
&& (docker_run_opts !~ %r{--cgroupns})
189+
end
190+
191+
creation_command = "docker run -d -it --privileged --tmpfs /tmp:exec -p #{front_facing_port}:22 --name #{full_container_name} "
188192
creation_command += "#{docker_run_opts} " unless docker_run_opts.nil?
189193
creation_command += image
190194
run_local_command(creation_command).strip

tasks/docker_exp.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ def provision(docker_platform, inventory_location, vars)
1717
var_hash = YAML.safe_load(vars)
1818
docker_run_opts = var_hash['docker_run_opts'].flatten.join(' ') unless var_hash['docker_run_opts'].nil?
1919
end
20+
unless docker_run_opts.nil?
21+
docker_run_opts += ' --volume /sys/fs/cgroup:/sys/fs/cgroup:rw' if (docker_platform =~ %r{debian|ubuntu}) \
22+
&& (docker_run_opts !~ %r{--volume /sys/fs/cgroup:/sys/fs/cgroup})
23+
docker_run_opts += ' --cgroupns=host' if (docker_platform =~ %r{debian|ubuntu}) \
24+
&& (docker_run_opts !~ %r{--cgroupns})
25+
end
2026

2127
creation_command = "docker run -d -it --privileged #{docker_run_opts} #{docker_platform}"
2228
container_id = run_local_command(creation_command).strip[0..11]

0 commit comments

Comments
 (0)