Assume the container is removed if it is not show in docker ps
In some case, docker can not remove container and raise following error message: Unable to remove filesystem for xxx remove /var/lib/docker/containers/xxx/shm: device or resource busy But the container is removed. This patch assumes container is removed if only container name is not shown in docker ps. Closes-Bug: #1662598 Change-Id: I079d5ec6178018403ec7a49c975f137e27eb9ad4
This commit is contained in:
parent
e9c4a5877d
commit
ea1ae405ba
@ -478,10 +478,18 @@ class DockerWorker(object):
|
||||
def remove_container(self):
|
||||
if self.check_container():
|
||||
self.changed = True
|
||||
self.dc.remove_container(
|
||||
container=self.params.get('name'),
|
||||
force=True
|
||||
)
|
||||
# NOTE(jeffrey4l): in some case, docker failed to remove container
|
||||
# filesystem and raise error. But the container info is
|
||||
# disappeared already. If this happens, assume the container is
|
||||
# removed.
|
||||
try:
|
||||
self.dc.remove_container(
|
||||
container=self.params.get('name'),
|
||||
force=True
|
||||
)
|
||||
except docker.errors.APIError:
|
||||
if self.check_container():
|
||||
raise
|
||||
|
||||
def generate_volumes(self):
|
||||
volumes = self.params.get('volumes')
|
||||
|
Loading…
x
Reference in New Issue
Block a user