How to copy an image from Docker Hub to your Docker Registry

Some images on Docker Hub require the acknowledgement of the terms and conditions. This prevents CI/CD pipelines and other automated build systems to pull the image with the error message:

error building image: GET https://index.docker.io/v2/store/…   : UNAUTHORIZED: authentication required; [map[Action:pull Class: Name:store/…  Type:repository]]

To solve the problem, we can manually pull the image to our workstation, tag the image with our Docker Registry URL, and push the image to our Docker Registry. In this example we will use the Oracle Database Instant Client docker image.

  • Log into Docker Hub
    docker login
  • Pull the image to your local machine from Docker Registry
    docker pull store/oracle/database-instantclient:12.2.0.1
  • Tag the image with your Docker Registry URL
    docker tag store/oracle/database-instantclient:12.2.0.1 MY_DOCKER_REGISTRY_URL/oracle/database-instantclient:12.2.0.1
  • Log into your Docker Registry
    docker login MY_DOCKER_REGISTRY_URL
  • Push the image to your Docker Registry
    docker push MY_DOCKER_REGISTRY_URL/oracle/database-instantclient:12.2.0.1

Leave a comment

Your email address will not be published.