In my DockerFile I have my FROM line like so :
FROM openjdk:11-jdk-alpine as build
Previously it was on java 8 and everything was working fine.
Now I get this error :
C:\dev\shape-shop-back-end>docker build .
[+] Building 2.0s (5/5) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 1.31kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CANCELED [internal] load metadata for docker.io/library/openjdk:11-jre-alpine 1.8s
=> ERROR [internal] load metadata for docker.io/library/openjdk:11-jdk-alpine 1.8s
=> [auth] library/openjdk:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/openjdk:11-jdk-alpine:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: docker.io/library/openjdk:11-jdk-alpine: not found
My docker file :
#### Stage 1: Build the application
FROM openjdk:11-jdk-alpine as build
# Set the current working directory inside the image
WORKDIR /app
# Copy maven executable to the image
COPY mvnw .
COPY .mvn .mvn
# Copy the pom.xml file
COPY pom.xml .
# Build all the dependencies in preparation to go offline.
# This is a separate step so the dependencies will be cached unless
# the pom.xml file has changed.
RUN ./mvnw dependency:go-offline -B
# Copy the project source
COPY src src
# Package the application
RUN ./mvnw package -DskipTests
RUN mkdir -p target/dependency && (cd target/dependency; jar -xf ../*.jar)
#### Stage 2: A minimal docker image with command to run the app
FROM openjdk:11-jre-alpine
ARG DEPENDENCY=/app/target/dependency
# Copy project dependencies from the build stage
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
ENTRYPOINT ["java","-cp","app:app/lib/*","com.shapeshop.App"]
#ARG JAR_FILE=target/*.jar
#COPY ${JAR_FILE} app.jar
#ENTRYPOINT ["java","-jar","/app.jar"]
#
## Expose port 80 to the Docker host, so we can access it
## from the outside.
#EXPOSE 8080
Am I missing something?
If I do a FROM without the "alpine" like so :
FROM openjdk:11 as build
then it worked for me
This may help: https://hub.docker.com/_/openjdk
"The OpenJDK port for Alpine is not in a supported release by OpenJDK, since it is not in the mainline code base. It is only available as early access builds of OpenJDK Project Portola. See also this comment. So this image follows what is available from the OpenJDK project's maintainers.
What this means is that Alpine based images are only released for early access release versions of OpenJDK. Once a particular release becomes a "General-Availability" release, the Alpine version is dropped from the "Supported Tags"; they are still available to pull, but will no longer be updated."
I don't use java images, this may suffice instead: https://hub.docker.com/r/adoptopenjdk/openjdk11/
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