@@ -223,6 +223,13 @@ def verify(container):
223
223
if not os .path .exists (source ):
224
224
raise ConfigError (f'Volume "{ volume } " source path "{ source } " does not exist!' )
225
225
226
+ if 'tmpfs' in container_config :
227
+ for tmpfs , tmpfs_config in container_config ['tmpfs' ].items ():
228
+ if 'destination' not in tmpfs_config :
229
+ raise ConfigError (f'tmpfs "{ tmpfs } " has no destination path configured!' )
230
+ if 'size' not in tmpfs_config :
231
+ raise ConfigError (f'tmpfs "{ tmpfs } " has no size configured!' )
232
+
226
233
if 'port' in container_config :
227
234
for tmp in container_config ['port' ]:
228
235
if not {'source' , 'destination' } <= set (container_config ['port' ][tmp ]):
@@ -362,6 +369,14 @@ def generate_run_arguments(name, container_config):
362
369
prop = vol_config ['propagation' ]
363
370
volume += f' --volume { svol } :{ dvol } :{ mode } ,{ prop } '
364
371
372
+ # Mount tmpfs
373
+ tmpfs = ''
374
+ if 'tmpfs' in container_config :
375
+ for tmpfs_config in container_config ['tmpfs' ].values ():
376
+ dest = tmpfs_config ['destination' ]
377
+ size = tmpfs_config ['size' ]
378
+ tmpfs += f' --mount=type=tmpfs,tmpfs-size={ size } M,destination={ dest } '
379
+
365
380
host_pid = ''
366
381
if 'allow_host_pid' in container_config :
367
382
host_pid = '--pid host'
@@ -373,7 +388,7 @@ def generate_run_arguments(name, container_config):
373
388
374
389
container_base_cmd = f'--detach --interactive --tty --replace { capabilities } --cpus { cpu_quota } { sysctl_opt } ' \
375
390
f'--memory { memory } m --shm-size { shared_memory } m --memory-swap 0 --restart { restart } ' \
376
- f'--name { name } { hostname } { device } { port } { name_server } { volume } { env_opt } { label } { uid } { host_pid } '
391
+ f'--name { name } { hostname } { device } { port } { name_server } { volume } { tmpfs } { env_opt } { label } { uid } { host_pid } '
377
392
378
393
entrypoint = ''
379
394
if 'entrypoint' in container_config :
0 commit comments