Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pull_image(self):
TEST_IMAGE='alpine:latest'
docker_client = get_docker_client()
l = docker_client.images()
tags = set(chain.from_iterable([i['RepoTags'] for i in l if i['RepoTags']]))
print(tags)
if TEST_IMAGE in tags:
docker_client.remove_image(TEST_IMAGE)
print('removed image %s' % TEST_IMAGE)
self.assertTrue(pull_image(TEST_IMAGE))
def setUpClass(self):
client = get_docker_client()
self.dockerfile_tags = []
for distro_version in ['xenial', 'bionic']:
dockerfile = """
FROM ubuntu:%(distro_version)s
RUN apt-get update && apt-get install x11-utils -y && apt-get clean
CMD xdpyinfo
"""
dockerfile_tag = 'testfixture_%s_x11_validate' % distro_version
iof = StringIO((dockerfile % locals()).encode())
im = client.build(fileobj = iof, tag=dockerfile_tag)
for e in im:
pass
#print(e)
self.dockerfile_tags.append(dockerfile_tag)