@@ -242,14 +242,15 @@ class Mount(dict):
242242 for the ``volume`` type.
243243 driver_config (DriverConfig): Volume driver configuration. Only valid
244244 for the ``volume`` type.
245+ subpath (str): Path inside a volume to mount instead of the volume root.
245246 tmpfs_size (int or string): The size for the tmpfs mount in bytes.
246247 tmpfs_mode (int): The permission mode for the tmpfs mount.
247248 """
248249
249250 def __init__ (self , target , source , type = 'volume' , read_only = False ,
250251 consistency = None , propagation = None , no_copy = False ,
251252 labels = None , driver_config = None , tmpfs_size = None ,
252- tmpfs_mode = None ):
253+ tmpfs_mode = None , subpath = None ):
253254 self ['Target' ] = target
254255 self ['Source' ] = source
255256 if type not in ('bind' , 'volume' , 'tmpfs' , 'npipe' ):
@@ -267,7 +268,7 @@ def __init__(self, target, source, type='volume', read_only=False,
267268 self ['BindOptions' ] = {
268269 'Propagation' : propagation
269270 }
270- if any ([labels , driver_config , no_copy , tmpfs_size , tmpfs_mode ]):
271+ if any ([labels , driver_config , no_copy , tmpfs_size , tmpfs_mode , subpath ]):
271272 raise errors .InvalidArgument (
272273 'Incompatible options have been provided for the bind '
273274 'type mount.'
@@ -280,6 +281,8 @@ def __init__(self, target, source, type='volume', read_only=False,
280281 volume_opts ['Labels' ] = labels
281282 if driver_config :
282283 volume_opts ['DriverConfig' ] = driver_config
284+ if subpath :
285+ volume_opts ['Subpath' ] = subpath
283286 if volume_opts :
284287 self ['VolumeOptions' ] = volume_opts
285288 if any ([propagation , tmpfs_size , tmpfs_mode ]):
0 commit comments