|
|
|
@ -55,7 +55,7 @@ def docker_mapped_port(cid, port, timeout_seconds=15): |
|
|
|
|
while time.time() - started < timeout_seconds: |
|
|
|
|
try: |
|
|
|
|
output = subprocess.check_output('docker port %s %s' % (cid, port), |
|
|
|
|
stderr=_DEVNULL |
|
|
|
|
stderr=_DEVNULL, |
|
|
|
|
shell=True) |
|
|
|
|
return int(output.split(':', 2)[1]) |
|
|
|
|
except subprocess.CalledProcessError as e: |
|
|
|
@ -85,7 +85,9 @@ def remove_image(image, skip_nonexistent=False, max_retries=10): |
|
|
|
|
if skip_nonexistent and not image_exists(image): |
|
|
|
|
return True |
|
|
|
|
for attempt in range(0, max_retries): |
|
|
|
|
if subprocess.call(['docker','rmi', '-f', image]) == 0: |
|
|
|
|
if subprocess.call(['docker','rmi', '-f', image], |
|
|
|
|
stdout=_DEVNULL, |
|
|
|
|
stderr=subprocess.STDOUT) == 0: |
|
|
|
|
return True |
|
|
|
|
time.sleep(2) |
|
|
|
|
print 'Failed to remove docker image %s' % image |
|
|
|
|