@@ -110,13 +110,18 @@ class ContainerSpec(dict):
110
110
containers. Only used for Windows containers.
111
111
init (boolean): Run an init inside the container that forwards signals
112
112
and reaps processes.
113
+ cap_add (:py:class:`list`): A list of kernel capabilities to add to the
114
+ default set for the container.
115
+ cap_drop (:py:class:`list`): A list of kernel capabilities to drop from
116
+ the default set for the container.
113
117
"""
114
118
def __init__ (self , image , command = None , args = None , hostname = None , env = None ,
115
119
workdir = None , user = None , labels = None , mounts = None ,
116
120
stop_grace_period = None , secrets = None , tty = None , groups = None ,
117
121
open_stdin = None , read_only = None , stop_signal = None ,
118
122
healthcheck = None , hosts = None , dns_config = None , configs = None ,
119
- privileges = None , isolation = None , init = None ):
123
+ privileges = None , isolation = None , init = None , cap_add = None ,
124
+ cap_drop = None ):
120
125
self ['Image' ] = image
121
126
122
127
if isinstance (command , str ):
@@ -186,6 +191,18 @@ def __init__(self, image, command=None, args=None, hostname=None, env=None,
186
191
if init is not None :
187
192
self ['Init' ] = init
188
193
194
+ if cap_add is not None :
195
+ if not isinstance (cap_add , list ):
196
+ raise TypeError ('cap_add must be a list' )
197
+
198
+ self ['CapabilityAdd' ] = cap_add
199
+
200
+ if cap_drop is not None :
201
+ if not isinstance (cap_drop , list ):
202
+ raise TypeError ('cap_drop must be a list' )
203
+
204
+ self ['CapabilityDrop' ] = cap_drop
205
+
189
206
190
207
class Mount (dict ):
191
208
"""
0 commit comments