Allow configuring security options

Change-Id: I27c202344c1e8be5f0e0da710c8fb18f0bc398b9
This commit is contained in:
Juan Antonio Osorio Robles 2018-03-20 15:43:39 +02:00
parent 17943fc611
commit 9b8c252b75
3 changed files with 11 additions and 2 deletions

View File

@ -182,6 +182,8 @@ class ComposeV1Builder(object):
cmd.append('--volumes-from=%s' % v)
if 'log_tag' in cconfig:
cmd.append('--log-opt=tag=%s' % cconfig['log_tag'])
if 'security_opt' in cconfig:
cmd.append('--security-opt=%s' % cconfig['security_opt'])
cmd.append(cconfig.get('image', ''))
cmd.extend(self.command_argument(cconfig.get('command')))

View File

@ -418,7 +418,8 @@ three-12345678 three''', '', 0),
'retries': 3
},
'env_file': '/tmp/foo.env',
'log_tag': '{{.ImageName}}/{{.Name}}/{{.ID}}'
'log_tag': '{{.ImageName}}/{{.Name}}/{{.ID}}',
'security_opt': 'label:disable'
}
}
builder = compose1.ComposeV1Builder('foo', config, None)
@ -432,7 +433,8 @@ three-12345678 three''', '', 0),
'--uts=host', '--health-cmd=/bin/true', '--health-interval=30s',
'--health-timeout=10s', '--health-retries=3',
'--privileged=true', '--restart=always', '--user=bar',
'--log-opt=tag={{.ImageName}}/{{.Name}}/{{.ID}}', 'centos:7'],
'--log-opt=tag={{.ImageName}}/{{.Name}}/{{.ID}}',
'--security-opt=label:disable', 'centos:7'],
cmd
)

View File

@ -0,0 +1,5 @@
---
features:
- |
Add `--security-opt=xxx` option for the action run a container. Allows to
define security options, such as turning labels (SELinux) on/off.