Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ env/
venv/
.idea/
*.iml
.venv/
11 changes: 10 additions & 1 deletion docker/types/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,17 @@ def __init__(self, version, binds=None, port_bindings=None,
'security_opt', security_opt, 'list'
)

self['SecurityOpt'] = security_opt
filtered = []

for opt in security_opt:
if opt == "systempaths=unconfined":
self['MaskedPaths'] = []
self['ReadonlyPaths'] = []
else:
filtered.append(opt)

self['SecurityOpt'] = filtered

if sysctls:
if not isinstance(sysctls, dict):
raise host_config_type_error('sysctls', sysctls, 'dict')
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,15 @@ def test_create_host_config_secopt(self):
assert result['SecurityOpt'] == security_opt
with pytest.raises(TypeError):
self.client.create_host_config(security_opt='wrong')

def test_create_host_config_systempaths_unconfined(self):
result = self.client.create_host_config(
security_opt=["systempaths=unconfined"]
)

assert result['MaskedPaths'] == []
assert result['ReadonlyPaths'] == []
assert result['SecurityOpt'] == []

def test_stream_helper_decoding(self):
status_code, content = fake_api.fake_responses[f"{url_prefix}events"]()
Expand Down