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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With