I'm having trouble understanding this error when trying to build a project in Docker:
> [internal] load metadata for docker.io/library/openjdk:11:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: unexpected status: 401 Unauthorized'
What does this error mean exactly? Am I missing permissions?
For reference, this is what my Dockerfile looks like:
### base jdk image ###
FROM openjdk:11 as setup
ENV USER sc_user
ENV HOME /home/$USER
ENV REPO $HOME/sc
RUN useradd -u 9999 $USER
COPY --chown=$USER build.gradle gradlew $REPO/
COPY --chown=$USER gradle $REPO/gradle
USER $USER
WORKDIR $REPO
RUN ./gradlew
FROM setup as tdd
ENTRYPOINT ["./gradlew", "-t", "test"]
FROM setup as debug-tdd
ENTRYPOINT ["./gradlew", "-t", "test", "-PjvmArgs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005"]
### build jar ###
FROM setup as build
COPY --chown=$USER src $REPO/src
RUN ./gradlew clean test build generatePomFileForMavenJavaPublication
If you are running Docker on Linux, you can enable BuildKit either by using an environment variable or by making BuildKit the default setting. To set the BuildKit environment variable when running the docker build command, run: $ DOCKER_BUILDKIT=1 docker build . Buildx always enables BuildKit.
Docker BuildKit is the next generation container image builder, which helps us to make Docker images more efficient, secure, and faster. It's integrated into the Docker release version v18.06. BuildKit is a part of the Moby project which was developed after learning's and failures to make the image build process –
It looks like you have buildkit enabled in your docker configuration. Buildkit is not stable yet and can cause these type of problems. Please try it again with buildkit disabled.
In Linux, using environment variables:
export DOCKER_BUILDKIT=0
export COMPOSE_DOCKER_CLI_BUILD=0
In Windows and macOS, start the Docker Desktop application, go to Settings, select Docker Engine and look for the existing entry:
"buildkit": true
Change this entry to disable buildkit:
"buildkit": false
Then click on Apply & Restart and try it again.
I have also faced this problem after giving the update to new version on my mac. However I have solved the problem after login from terminal.
The commands were:
docker login
After that I have provided the username and password of docker. The problem was fixed.
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