Commit bb95765c authored by Mitar's avatar Mitar

Remove Docker images before pulling a new one.


Former-commit-id: 4da64853
parent bc8fb5f6
......@@ -382,7 +382,17 @@ def validate_installation(primitive_names, interface_version, installation, anno
docker_image = f'registry.gitlab.com/datadrivendiscovery/images/primitives:ubuntu-{image_ubuntu_version}-{image_interface_version}'
new_cli_interface = True
# Run a container which sleeps until we stop it. First we pull the latest version of the image.
# Run a container which sleeps until we stop it. First we remove all existing Docker images to make the space for the new one.
print(">>> Removing exiting Docker images.")
for image in docker_client.images.list():
# If we already have the image we want to run, we do not remove it.
if docker_image in image.tags:
continue
# Otherwise we remove it.
docker_client.images.remove(image.id)
# Then we pull the latest version of the image.
print(">>> Pulling Docker image '{docker_image}'.".format(docker_image=docker_image), flush=True)
previous_chunk = None
for chunk in docker_client.api.pull(docker_image, stream=True, decode=True):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment