File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -317,21 +317,26 @@ def start(self, timeout=60):
317
317
"USE_SSL" : use_ssl ,
318
318
}
319
319
320
- if self .persistent :
321
- environment ['DATA_DIR' ] = '/tmp/localstack/data'
322
-
323
320
try :
324
321
_container = self .docker_client .containers .get (self .container_name )
325
322
_container .start ()
326
323
self ._container = _container
327
324
except (docker .errors .NotFound , docker .errors .APIError ):
325
+ if self .persistent :
326
+ host_data_dir = '/tmp/localstack/data'
327
+ container_data_dir = '/tmp/localstack_data'
328
+ environment ['DATA_DIR' ] = host_data_dir
329
+
328
330
self ._container = self .docker_client .containers .run (
329
331
image_name ,
330
332
name = self .container_name ,
331
333
detach = True ,
332
334
auto_remove = self .auto_remove ,
333
335
environment = environment ,
334
336
ports = {port : None for port in self .services .values ()},
337
+ volumes = {
338
+ host_data_dir : {'bind' : container_data_dir , 'mode' : 'rw' },
339
+ },
335
340
)
336
341
logger .debug (
337
342
"Started Localstack container %s (id: %s)" ,
You can’t perform that action at this time.
0 commit comments