Gitlab-runner use docker build image Error load metadata for docker.io/library/openjdk:8-jre-alpine

Dear all,

Im using gitlab-ci to build image, while build i have a problem load metadata for openjdk:8-jre-alpine
My server is offline, Internet is restricted

can i force load from internet and change it into offline server.

here is my log, thanks !

$ docker build -t myproject .
#1 [internal] load build definition from Dockerfile
#1 sha256:c48ce823701392d81567204fcef3f403de2406f104b5961d6daf1768f599a29f
#1 transferring dockerfile: 560B done
#1 ...
#2 [internal] load .dockerignore
#2 sha256:8fd3edce30e528c10487a03cae2891a8cf3150acd652f23cf9c3e2175ea23c37
#2 transferring context: 2B done
#2 DONE 1.3s
#1 [internal] load build definition from Dockerfile
#1 sha256:c48ce823701392d81567204fcef3f403de2406f104b5961d6daf1768f599a29f
#1 DONE 1.4s
#3 [internal] load metadata for docker io/library/openjdk:8-jre-alpine
#3 sha256:54c6f6c810fe8adaea295f024fab13dc1a9a70e363a76f4d0bfb6e7ae191ebae
#3 ERROR: failed to do request: Head "https://registry-1.docker.io/v2/library/openjdk/manifests/8-jre-alpine": dial tcp: lookup registry-1.docker.io: i/o timeout
------
 > [internal] load metadata for docker io library openjdk:8-jre-alpine:
------
ERROR: Job failed: exit code 1

anyone help you, thanks !

Running containers in an air-gapped environment is not uncommon.

Are you familiar with running/using images from a private image registry?
If not: How to Use Your Own Registry | Docker

To make docker use images from your private registry, instead of repo:image, you will need to provide registry-fqdn-or-ip/repo:image. WIthout prefixing the repo with the fqdn or ip of your registry, docker can’t know that you intend to use images from a private registry and wouldn’t know where to look for the image.

The typical flow is:

  • pull the image from a host with internet access
  • tag the image to prefix the repo name with the fqdn or ip of the registry
  • push the image using the new tag

In case you get permission error when pushing, execute a docker login {regstry fqdn or ip} (make sure you use the fqdn or the ip consistently)

When pulling the image, use the new tag. When building an Image, make sure to use the new tag in the FROM instruction of the Dockerfile.

1 Like