Client Error: Bad Request ("b'OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "/usr/lib/jvm/java-8-openjdk-amd64/bin/java": stat /usr/lib/jvm/java-8-openjdk-amd64/bin/java: no such file or directory: unknown'")
this my error ,I cann't fix this ,when I use docker-compose and docker
my version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:45:44 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:44:15 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.18.0
GitCommit: fec3683
docker compose version
docker-compose version 1.25.0, build unknown
docker-py version: 4.1.0
CPython version: 3.8.10
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
Dockerfile
FROM openjdk:8-jdk
# Install maven
RUN apt-get update
RUN apt-get install -y maven
WORKDIR /code
# Prepare by downloading dependencies
ADD pom.xml /code/pom.xml
RUN ["mvn", "dependency:resolve", "-U"]
RUN ["mvn", "verify"]
# Adding source, compile and package into a fat jar
ADD src /code/src
RUN ["mvn", "package", "-DskipTest=True", "-Dmaven.javadoc.skip=true", "-Dmaven.test.skip=true", "--offline"]
EXPOSE 4458
# CMD ["ls", "-la", "target/"]
ENTRYPOINT ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "target/pbft-jar-with-dependencies.jar"]
docker-compose.yml
version: '2'
services:
node_java:
extends:
file: docker-compose.node-java.yml
service: node
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
NODE_DEBUG: "False"
docker-compose.node-java.yml
version: '2'
services:
node:
build: .
environment:
NODE_PORT: 4458
command: ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"]
# restart: "unless-stopped"
# stdin_open: true
node-pi:
build:
context: .
dockerfile: ARM.Dockerfile
environment:
NODE_PORT: 4458
Any suggestion will help !!!
thank you very much
I think the path to the java executable in the image is different than the one you used.
Can you try and replace the path in your DOCKERFILE like so?
ENTRYPOINT ["/usr/local/openjdk-8/bin/java", "-jar", "target/pbft-jar-with-dependencies.jar"]
I used the following procedure to find that out:
docker pull openjdk:8-jdk
docker run openjdk:8-jdk
docker container ls -a
mkdir -p /tmp/snapshot
cd /tmp/snapshot
docker export 7778d9fa6ce9> snapshot.tar
tar -xvf snapshot.tar
find . -type f -name java
modify Old java site
to this
/usr/local/openjdk-8/bin/java
it is error
second
I fix this using old version docker and docker-compose
modify version :
Since my project is 2017, I choose the old version of docker and the docker compose version close to 2017
detail version
docker-ce | 5:18.09.0~3-0~ubuntu-bionic | https://download.docker.com/linux/ubuntu bionic/stable amd64 Packages
docker compose
https://github.com/docker/compose/releases/tag/1.16.1
1.16.1
Related
I am new to docker-compose and probably don't understand the ideology behind.
Short question -- I see there is docker-compose build command. I'd like to trigger a (gradle) script outside of the Dockerfile file as part of running it.
Let's say that I have a java web service inside Docker that I build in advance by gradle.
I don't add gradle agent to the Dockerfile (as I am expected to keep it small, right?), I only COPY binaries
FROM openjdk:17-jdk-alpine
RUN apk add --no-cache bash
VOLUME /var/log/app/
WORKDIR /app
ARG EXTRACTED
COPY ${EXTRACTED}/application/ ./
...
ENTRYPOINT ["java","org.springframework.boot.loader.JarLauncher"]
And so I build this image by a script
./gradlew build
java -Djarmode=layertools -jar build/libs/*.jar extract --destination build/libs-extracted/
docker build --build-arg EXTRACTED=build/libs-extracted -t my-server .
I can define the following compose.yml. How do I trigger gradle inside of it? Or, same as with my single Dockerfile, I am expected to wrap docker-compose build into a build script?
version: '3.1'
services:
db:
image: postgres:alpine
restart: always
my-server:
image: my-server
restart: always
depends_on:
- db
Maybe I am asking for a hack, but actually I am happy to take another approach if it's cleaner
I discovered multi-stage Dockerfile feature that addresses my task, and I can use it for both individual Dockerfile builds and docker-compose builds.
https://stackoverflow.com/a/61131308/1291049.
I will probably lose gradle daemon optimisations though.
Change your docker compose file:
version: '3.1'
services:
db:
image: postgres:alpine
restart: always
my-server:
build:
context: ./my-server
dockerfile: Dockerfile
restart: always
depends_on:
- db
When I try to run this Docker image it stays stuck forever:
FROM gradle:7.4.2-jdk11 as build
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false"
WORKDIR /usr/src/app
COPY . .
RUN ./gradlew shadowJar
FROM adoptopenjdk:latest
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/build/libs ./
This is the docker-compose.yml file:
version: "3.8"
services:
slack_bot:
container_name: slack_bot
platform: linux/amd64
build: .
ports:
- "8000:8000"
environment:
PORT: 8000
command: java -jar build/libs/slack-bot-1.0-SNAPSHOT-all.jar
This is the output of docker-compose up (stuck there with the seconds increasing forever):
=> [build 4/4] RUN ./gradlew shadowJar 803.1s
=> => # - Aggregated test and JaCoCo reports
=> => # - Marking additional test source directories as tests in IntelliJ
=> => # - Support for Adoptium JDKs in Java toolchains
=> => # For more details see https://docs.gradle.org/7.4.2/release-notes.html
=> => # To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4.2/userguide/gradle_daemon.html#sec:disabling_the_daemon.
=> => # Daemon will be stopped at the end of the build
I tried multiple variations including turning on/off the Docker daemon, different Docker images, increasing JVM memory, etc. without success. I'm using the latest Docker (4.8.2) on an Apple M1. Any hints?
Has anyone come across this error when trying to execute a docker-compose up command.
I have tried to resolve it by looking at other articles that touch on something similar but I am having no success.
I am trying to run my spring boot app using a docker-compose file and I keep getting this error:
qemu-x86_64: Could not open '/lib/ld-musl-x86_64.so.1': No such file or directory
I have tried to fix it by following the advice I read online but nothing has worked.
I have tried:
After reading this post: https://github.com/nodejs/help/issues/3239
adding the following
platform: linux/amd64
to my docker-compose file but it doesn't make a difference
and tried FROM --platform=linux/amd64 in front of my Dockerfile
When I read this I tried to install musl as well but failed to execute the make command
curl https://musl.libc.org/releases/musl-1.2.2.tar.gz -o musl-1.2.2.tar.gz
tar -xvf musl-1.2.2.tar.gz
cd musl-1.2.2
./configure
make
make install
My Docker file looks like this
FROM azul/zulu-openjdk-alpine:11 as packager
RUN { \
java --version ; \
echo "jlink version:" && \
jlink --version ; \
}
ENV JAVA_MINIMAL=/opt/jre
# build modules distribution
RUN jlink \
--verbose \
--add-modules \
java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \
# java.naming - javax/naming/NamingException
# java.desktop - java/beans/PropertyEditorSupport
# java.management - javax/management/MBeanServer
# java.security.jgss - org/ietf/jgss/GSSException
# java.instrument - java/lang/instrument/IllegalClassFormatException
--compress 2 \
--strip-debug \
--no-header-files \
--no-man-pages \
--output "$JAVA_MINIMAL"
# Second stage, add only our minimal "JRE" distr and our app
FROM alpine
ENV JAVA_MINIMAL=/opt/jre
ENV PATH="$PATH:$JAVA_MINIMAL/bin"
COPY --from=packager "$JAVA_MINIMAL" "$JAVA_MINIMAL"
COPY "build/libs/company-coordinator-app-0.0.1-SNAPSHOT.jar" "/company-coordinator-app.jar"
EXPOSE 8080
CMD [ "-jar", "/company-coordinator-app.jar" ]
ENTRYPOINT [ "java" ]
and my docker-compose.yml file looks like this
version: '2'
services:
company-coordinator-app:
container_name: 'company-coordinator-app'
build:
context: /Users/ciaran/cmkdev/company-coordinator-project/company-coordinator-app
dockerfile: Dockerfile
image: springio/gs-spring-boot-docker
ports:
- "8080:8080"
I am running this off an M1 mbp
I read this post on here in an attempt to build my Dockerfile correctly as I needed to use Java 11.
Java 11 application as lightweight docker image
If anyone has any insights here it would be greatly appreciated.
It seems azul/zulu-openjdk-alpine:11 doesn't have arm64 image needed to run on Apple silicon architecture.
Try updating to jdk 17 image with arm64 support https://hub.docker.com/r/azul/zulu-openjdk-alpine/
I just want to deploy my springboot applicaiton on the remote centos server through the intellij idea.
First I tried the way of DockerFile to deploy the application on intellij idea and I successed.
this is my DockerFile config
FROM williamyeh/java8
# COPY or ADD to image
COPY dockerdemo-0.0.1-SNAPSHOT.jar app.jar
RUN bash -c "touch /app.jar"
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
but when I tried the method of docker-compose.yml,I failed,I can't mapped my navtive jar to the remote system.my docker-compose.yml config is
version: "3"
services:
dockerDemo2:
image: adoptopenjdk/openjdk8:latest
container_name: dockerDemo2
privileged: true
environment:
TZ: Asia/Shanghai
LANG: es_US.UTF-8
volumes:
- ./dockerdemo-0.0.1-SNAPSHOT.jar:/docker/dockerdemo-0.0.1-SNAPSHOT.jar
command: bash -c " tail -f /dev/null "
ports:
- 8080:8080
I deployed successed,but when I get in the remote docker ,I found the /docker/dockerdemo-0.0.1-SNAPSHOT.jar is a directory, It should expected as a jar file,but it not,I don't know why that.that's really confuesed me.
I am using GitHub Actions for Gradle project with this given steps:
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: 11
- run: gradle wrapper
- run: ./gradlew bootJar
- run: ls ./build/libs/
- uses: actions/checkout#v1
- name: Login to docker
run: docker login docker.pkg.github.com -u xxxxxx -p xxxxxx
- uses: actions/checkout#v1
- name: Build the Docker image
run: docker build . -t realtimechat-snapshot-0.$GITHUB_REF
- uses: actions/checkout#v1
- name: Tag the image
run: docker tag realtimechat-snapshot-0.$GITHUB_REF realtimechat-snapshot-0
- uses: actions/checkout#v1
- name: Push the image
run: docker push realtimechat-snapshot-0.$GITHUB_REF
at Build the Docker image step it build this Dockerfile:
FROM alpine:latest
COPY ./build/libs/realtimeChattingSystem-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar
and when it tries to copy the jar file I get this error:
COPY failed: stat
/var/lib/docker/tmp/docker-builder207778036/build/libs/realtimeChattingSystem-0.0.1-SNAPSHOT.jar:
no such file or directory
NOTE*
at - run: ls ./build/libs/ in the steps it actually shows me the jar file:
Run ls ./build/libs/
realtimeChattingSystem-0.0.1-SNAPSHOT.jar
Issue #2
after doing the changes in this post
I faced another issue
this is the steps:
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v1
- name: Set up JDK 13
uses: actions/setup-java#v1
with:
java-version: 13
- run: ./gradlew bootJar
- name: Login to Github regestry
run: docker login docker.pkg.github.com -u xxxxx -p xxxxx
- name: Build the Docker image
run: docker build . -t docker.pkg.github.com/sulimanlab/realtime-chat/realtimechat-snapshot-0.$GITHUB_REF
- name: Push the image to github
run: docker push docker.pkg.github.com/sulimanlab/realtime-chat/realtimechat-snapshot-0.$GITHUB_REF
At the last step I get this error:
The push refers to repository
[docker.pkg.github.com/sulimanlab/realtime-chat/realtimechat-snapshot-0.refs/heads/master]
3aad04996f8f: Preparing
77cae8ab23bf: Preparing
error parsing HTTP 404 response body: invalid character 'p' after top-level value:
"404 page not found\n"
You only need to use actions/checkout once at the start of your workflow. When you use it again after building I think it's probably resetting your local workspace back to the GITHUB_SHA and your jar file is being deleted in the process.
Try this:
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: 11
- run: gradle wrapper
- run: ./gradlew bootJar
- run: ls ./build/libs/
- name: Login to docker
run: docker login docker.pkg.github.com -u xxxxxx -p xxxxxx
- name: Build the Docker image
run: docker build . -t realtimechat-snapshot-0.$GITHUB_REF
- name: Tag the image
run: docker tag realtimechat-snapshot-0.$GITHUB_REF realtimechat-snapshot-0
- name: Push the image
run: docker push realtimechat-snapshot-0.$GITHUB_REF