diff --git a/workers/dockerfilebuild.py b/workers/dockerfilebuild.py index b4e96f7fc..657c1df7e 100644 --- a/workers/dockerfilebuild.py +++ b/workers/dockerfilebuild.py @@ -122,11 +122,17 @@ class DockerfileBuildWorker(Worker): if not host: raise Exception('Invalid tag name: %s' % tag_name) - registry_endpoint = 'http://%s/v1/' % host.group(1) - docker_cl = Client(timeout=1200) - logger.debug('Attempting login to registry: %s' % registry_endpoint) - docker_cl.login('$token', token, registry=registry_endpoint) + + for protocol in ['https', 'http']: + registry_endpoint = '%s://%s/v1/' % (protocol, host.group(1)) + logger.debug('Attempting login to registry: %s' % registry_endpoint) + + try: + docker_cl.login('$token', token, registry=registry_endpoint) + break + except APIError: + pass # Probably the wrong protocol history = json.loads(docker_cl.history(built_image)) num_images = len(history)