Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dockerfile build raising insufficient_scope: authorization failed with public openjdk image

I'm trying to run the following Dockerfile using the command

docker-compose up --remove-orphans --force-recreate --build -d

Dockerfile:

FROM maven:3.6.3-jdk-11 as builder
COPY src /home/app/src     
COPY pom.xml /home/app
RUN mvn -f /home/app/pom.xml clean package

FROM openjdk:latest
COPY --from=build /usr/src/app/target/app.jar /home/app/app.jar
EXPOSE 8080
ENTRYPOINT ["java","-jar","/home/app/app.jar"]

The build stage runs ok, however the run stage raises the following error:

Building java
failed to get console mode for stdout: The handle is invalid.
[+] Building 1.5s (4/6)
=> [internal] load build definition from Dockerfile                       0.0s
=> [internal] load build definition from Dockerfile                       0.0s
=> => transferring dockerfile: 380B                                       0.0s
=> [internal] load .dockerignore                                          0.0s
=> => transferring context: 2B                                            0.0s
=> [internal] load metadata for docker.io/library/openjdk:latest          1.2s
=> ERROR FROM docker.io/library/build:latest                              1.7s
=> => resolve docker.io/library/build:latest                              1.7s
=> CACHED [stage-1 1/2] FROM docker.io/library/openjdk:latest@sha256:e4f  0.0srequire 
authorization: server message: insufficient_scope: authorization failed
=> [auth] library/build:pull token for registry-1.docker.io               0.0s

First I though it was an authentication problem so I logged in the Docker desktop, but still it does not work. Is there any log that I can check or any reference to try find the root of this problem?

Thanks in advance

like image 514
Fabio Araujo Avatar asked Dec 31 '22 16:12

Fabio Araujo


1 Answers

You named your stage as builder, but in next stage used name build.

FROM maven:3.6.3-jdk-11 as builder

COPY --from=build /usr/src/app/target/app.jar /home/app/app.jar

Choose one of those names

like image 67
qulaz Avatar answered Jan 05 '23 15:01

qulaz