Search code examples
dockerdocker-build

Docker build: Error [internal] load metadata for dockerhub


I'm a complete beginner in Docker and I've been asked to containerize our applications. I've been following and documentation and one of which is of course, to finally build our application with Docker. This is the command I'm trying to run:

docker build -t http2cas4:local --build-arg CI_REGISTRY=dockerhub.alea.ca --build-arg CAS_JBOSS_VERSION=1.0.0 .

However, I'm getting the following errors:

PS C:\Users\<my name>\IdeaProjects\Migration\http2cas4> docker build -t http2cas4:local --build-arg CI_REGISTRY=dockerhub.alea.ca --build-arg CAS_JBOSS_VERSION=1.0.0 .
[+] Building 0.7s (3/3) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                               0.0s 
 => => transferring dockerfile: 32B                                                                                                                                                                                                0.0s 
 => [internal] load .dockerignore                                                                                                                                                                                                  0.0s 
 => => transferring context: 2B                                                                                                                                                                                                    0.0s 
 => ERROR [internal] load metadata for dockerhub.alea.ca/firefly/product/casino/jboss:1.0.0                                                                                                                                        0.6s 
------
 > [internal] load metadata for dockerhub.alea.ca/firefly/product/casino/jboss:1.0.0:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch anonymous token: unexpected status: 403 Forbidden

I've checked what I can especially about the URL which looks to me like a repository in Dockerhub and our IT guys confirmed that I have access with it. After searching for answers, what I got so far are people who had working builds before so I'm not really sure if those applies to this one.

By the way, here's the docker file:

ARG CI_REGISTRY
ARG CAS_JBOSS_VERSION
FROM ${CI_REGISTRY}/firefly/product/casino/jboss:${CAS_JBOSS_VERSION}

COPY templates/config/*         /config/
COPY templates/logs/*           /app/jboss4/server/default/conf/

COPY target/http2cas4.war     /deploy/

If there's anything else that I can provide to solve this, please let me know. Any information would be greatly appreciated.


Solution

  • Just in case someone needs an answer for this one, here's what I did:

    • Logged in to our docker hub repo by using the docker login <repo> command
    • Checked if my access token has the api permission. I think I'm supposed to have the api and read_registry permissions (gitlab access token).

    After those were addressed, I was able to build the docker image