File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -317,21 +317,26 @@ def start(self, timeout=60):
317317 "USE_SSL" : use_ssl ,
318318 }
319319
320- if self .persistent :
321- environment ['DATA_DIR' ] = '/tmp/localstack/data'
322-
323320 try :
324321 _container = self .docker_client .containers .get (self .container_name )
325322 _container .start ()
326323 self ._container = _container
327324 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+
328330 self ._container = self .docker_client .containers .run (
329331 image_name ,
330332 name = self .container_name ,
331333 detach = True ,
332334 auto_remove = self .auto_remove ,
333335 environment = environment ,
334336 ports = {port : None for port in self .services .values ()},
337+ volumes = {
338+ host_data_dir : {'bind' : container_data_dir , 'mode' : 'rw' },
339+ },
335340 )
336341 logger .debug (
337342 "Started Localstack container %s (id: %s)" ,
You can’t perform that action at this time.
0 commit comments