Skip to content

Failed to build docker image with --load option

Description

I ran the following command to build docker image with --load option.

./build.sh -d --image-name my-remote-container-registry/cuda --cuda-version 11.6.2 --os ubuntu --os-version 20.04 --arch x86_64 --load

As a result, I could build my-remote-container-registry/cuda:11.6.2-base-ubuntu20.04 image. But, the following error occurred.

Command returned: 0

build.sh#256 Running command:

docker buildx build --pull --load --platform linux/x86_64 -t my-remote-container-registry/cuda:11.6.2-runtime-ubuntu20.04 --build-arg IMAGE_NAME=my-remote-container-registry/cuda dist/11.6.2/ubuntu2004/runtime 

Output: 

[+] Building 2.0s (3/3) FINISHED                                                                                                                                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                      0.6s
 => => transferring dockerfile: 2.04kB                                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                         0.5s
 => => transferring context: 2B                                                                                                                                                                                                                           0.0s
 => ERROR [internal] load metadata for docker.io/my-remote-container-registry/cuda:11.6.2-base-ubuntu20.04                                                                                                                                                1.4s
------
 > [internal] load metadata for docker.io/my-remote-container-registry/cuda:11.6.2-base-ubuntu20.04:
------
Dockerfile:2
--------------------
   1 |     ARG IMAGE_NAME
   2 | >>> FROM ${IMAGE_NAME}:11.6.2-base-ubuntu20.04 as base
   3 |     
   4 |     ENV NV_CUDA_LIB_VERSION 11.6.2-1
--------------------
ERROR: failed to solve: my-remote-container-registry/cuda:11.6.2-base-ubuntu20.04: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

There is my-remote-container-registry/cuda:11.6.2-base-ubuntu20.04 in local environment. But, it seems that this script tried to pull docker image from Docker Hub. I found a workaround to avoid this problem. The changes of build.sh is as follows.

-        run_cmd docker buildx build --pull ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
+        run_cmd docker build ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
             -t "${IMAGE_NAME}:${CUDA_VERSION}-base-${OS}${OS_VERSION}${IMAGE_SUFFIX:+-${IMAGE_SUFFIX}}" \
             "${BASE_PATH}/${OS_PATH_NAME}/base"
 
-        run_cmd docker buildx build --pull ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
+        run_cmd docker build ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
             -t "${IMAGE_NAME}:${CUDA_VERSION}-runtime-${OS}${OS_VERSION}${IMAGE_SUFFIX:+-${IMAGE_SUFFIX}}" \
             --build-arg "IMAGE_NAME=${IMAGE_NAME}" \
             "${BASE_PATH}/${OS_PATH_NAME}/runtime"
 
-        run_cmd docker buildx build --pull ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
+        run_cmd docker build ${LOAD_ARG} ${PUSH_ARG} ${PLATFORM_ARG} \
             -t "${IMAGE_NAME}:${CUDA_VERSION}-devel-${OS}${OS_VERSION}${IMAGE_SUFFIX:+-${IMAGE_SUFFIX}}" \
             --build-arg "IMAGE_NAME=${IMAGE_NAME}" \

Environment

  • OS: Ubuntu 22.04
  • Docker Engine: 23.0.4
  • nvidia-container-toolkit: 1.13.2
  • NVIDIA driver: 530.30.02
Edited by Yasuhiro Yoshimura