fowlball1010
fowlball1010

Reputation: 383

Dockerfile FROM Insecure Registry

Is there a way to build a docker image from a Dockerfile that uses a base image from a local, insecure registry hosted in Gitlab. For example, if my Dockerfile were:

FROM insecure.registry.local:/mygroup/myproject/image:latest

When I run docker build . I get the following error:

failed to solve with frontend dockerfile.v0: failed to create LLB definition:.... http: server gave HTTP response to HTTPS client

When I've been interacting with our registry and received similar types http/https errors, I would alter the docker daemon configuration file to include:

   ...
   "insecure-registries" : ["insecure.registry.local"]
   ...

and everything would work when executing a particular docker command that would trigger it. I'm able to run docker login insecure.registry.local successfully. Is there a way either in the Dockerfile itself, through the docker build command or other alternative to have it pull the image successfully in the FROM statement from an insecure registry?

Upvotes: 7

Views: 7279

Answers (2)

BMitch
BMitch

Reputation: 263617

Depending on your version, you may need to include the scheme in the insecure registry definition. Newer versions of buildkit should not have this issue, so an upgrade may also help.

   ...
   "insecure-registries" : [
     "insecure.registry.local",
     "http://insecure.registry.local"
   ]
   ...

Upvotes: 8

F1ko
F1ko

Reputation: 4224

Unfortunately there is not that much information about the actual error.

So here are a couple of things that may fix the issue you described:

  • Ensure your file is called Dockerfile (only the D is supposed to be capitalized)
  • Reload and restart the docker daemon after your changes (sudo systemctl daemon-reload && sudo systemctl restart docker)
  • Don't use the docker buildkit (export DOCKER_BUILDKIT=0 && export COMPOSE_DOCKER_CLI_BUILD=0 && docker build .

Upvotes: 3

Related Questions