Do not check security opt in some case in kolla_docker module

Security opt is disable when using host ipc or host pid or
privileged[0].

[0]
https://github.com/docker/docker/blob/master/daemon/create.go#L161,L164

Change-Id: I83d7c74aaeb5c59981c76464e69d5b5baa00fefb
This commit is contained in:
Jeffrey Zhang 2017-02-06 11:00:37 +08:00
parent af5a81b551
commit 950feb1e1c

View File

@ -309,6 +309,13 @@ class DockerWorker(object):
return True
def compare_security_opt(self, container_info):
ipc_mode = self.params.get('ipc_mode')
pid_mode = self.params.get('pid_mode')
privileged = self.params.get('privileged', False)
# NOTE(jeffrey4l) security opt is disabled when using host ipc mode or
# host pid mode or privileged. So no need to compare security opts
if ipc_mode == 'host' or pid_mode == 'host' or privileged:
return False
new_sec_opt = self.params.get('security_opt', list())
current_sec_opt = container_info['HostConfig'].get('SecurityOpt',
list())