Docker Compose run or Make build throws error for particular service

Dear Members,

I am running the docker-compose or ‘make build’ command.
The docker-compose.yml file has few services in the order CLI > Nginx > PHP > MariaDB
Within each service section, using the dockerfile property, the path to service ( cli, Nginx, PHP ) are defined, sort of as below for each service.

    build:
      context: .
      dockerfile: .lagoon/cli.dockerfile

On running the ‘make build’ command, CLI service completes successfully but Nginx service run lands in below error.

Building Nginx
[+] Building 2.2s (5/5) FINISHED
 => [internal] load build definition from nginx.dockerfile                                              0.0s
 => => transferring dockerfile: 1.21kB                                                                  0.0s
 => [internal] load .dockerignore                                                                       0.0s
 => => transferring context: 35B                                                                        0.0s
 => CANCELED [internal] load metadata for harbor-nginx-lagoon.XXXXXXX.com/XXXXXX/XXXX_nginx:2021  2.1s
 => ERROR [internal] load metadata for docker.io/library/XXXXXX-training-sandbox:latest              2.1s
 => [auth] library/XXXXXX-training-sandbox:pull token for registry-1.docker.io                       0.0s
------
 > [internal] load metadata for docker.io/library/XXXXXX-training-sandbox:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
ERROR: Service 'nginx' failed to build : Build failed
make: *** [build] Error 1

I tried to read a bit in google trying to figure out the cause of this error but I understand that it is related to insufficient scope or authorization. May I request some guidance on what is the right actions probably towards resolution?

Request suggestion.
Thank you in advance.

Arivvu

What are those “XXXXXX” characters in the image repository name? Did you modify the error message to hide sensitive information or is it the original message? The part of the message I quoted above means it cannot decide the real reson. But I guess it is not the matter of authentication but an invalid repository name.

Hi, Akos san,

The “XXXXXX” characters were used to mask sensitive information. It is not part of the original message.

May I ask you doubt for your suggestion? Does it mean something is missing in my local environment or build process is looking up a repo on some remote location and can’t find it?

Regards,

Arivvu

I did not understand why you would hide the name of the image since it is not like a password but you can have your reasons, so it is alright. If you are absolutely certain all of the repositories exist, than my next question is: could you download the images without Docker compose? Are you sure you used “docker login” to log in each registry you need for this compose project?

Yes. When I run the make build command, I am able to find
Stage 1: the docker login attempted and login succeeded. I find the authentication token username and password in .env file which gets used in make build properly.
Stage 2: the docker pull attempted and status flagged as up-to-date.
Stage 3: then, docker-compose -f docker-compose.yml -f docker-compose.local.yml build --no-cache gets initiated and I see that it successfully finishes the first service [ CLI ] build proper. It is with Service setup [ Nginx ] this error get thrown.

Thanks!

Arivvu

I see two different registries in the error message. “docker.io” and “harbor-nginx-lagoon.XXXXXXX.com”. Is this a multi-staged build? Or one of the registries somehow redirects to the other?

I tell you what I cannot understand. Maybe you can explain in to me.

The above repository looks like an official Docker image but I cannot find anything official with a name ending with “training-sandbox”. Is it possible that there are private official repositories from which you can pull images?

If it is a multi-staged build, could you share your Dockerfile without the whole content only with the “FROM” lines (with X characters as in the error message) and references to the stages like COPY --from=stagename

You could also try to disable buildkit. I find buildkit surprisingly often to be the reason of unexpected error messages recently.

Now I am just guessing because I have never seen this message in my projects.

Hi, Rimelek san,

I understand. Yes, silly me! The buildkit was set to true and turning it off saved me.
Thanks for the consideration

Regards

Arivvu