坏蛋运行时插件 然后在Alpine上执行。但却出现了以下的错误信息。如果我做了如下的事情
jibcmd_1 | /bin/sh: exec: line 1: ./bin/jibcmd: not found
毫无疑问,这个文件是存在的。docker run -it jibcmd_jibcmd ls -l /app/bin/jibcmd
如果我把我的父镜像从Alpine改成Debian,一切都能正常工作。但我想使用Alpine。
下面是我的 build.gradle 文件
以下是我的Docker文件
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'application'
id "com.github.johnrengelman.shadow" version "5.2.0"
id "org.beryx.runtime" version "1.8.0"
}
group 'org.example'
version '1.0.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "com.github.ajalt:clikt:2.3.0"
implementation "com.google.cloud.tools:jib-core:0.12.0"
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.4.0-b180830.0438'
implementation 'com.sun.xml.ws:jaxws-ri:2.3.2'
}
runtime {
modules = ['java.logging', 'java.desktop', 'java.compiler', 'java.xml']
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
有什么建议可以让这个在阿尔卑斯山上运行?
FROM openjdk:14-jdk-buster AS builder
WORKDIR /src
COPY *.gradle *.properties gradlew ./
COPY gradle gradle
RUN ./gradlew --version
COPY . .
RUN ./gradlew jpackageImage
FROM alpine
#FROM debian
WORKDIR /app
COPY --from=builder /src/build/jpackage/jibcmd .
CMD exec ./bin/jibcmd
更新
ldd仍然声称缺少ld-linux-x86-64.so.2......
$ docker run -it jibcmd_jibcmd sh
/app # ldd /app/bin/jibcmd
/lib64/ld-linux-x86-64.so.2 (0x7f0f4ba6a000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f0f4ba6a000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f0f4ba6a000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f0f4ba6a000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /app/bin/jibcmd)
/app # ls -l /lib64/ld-linux-x86-64.so.2
ls: /lib64/ld-linux-x86-64.so.2: No such file or directory
/app # apk add libc6-compat
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
(1/1) Installing libc6-compat (1.1.24-r2)
OK: 6 MiB in 15 packages
/app # ls -l /lib64/ld-linux-x86-64.so.2
lrwxrwxrwx 1 root root 26 Apr 6 13:05 /lib64/ld-linux-x86-64.so.2 -> /lib/libc.musl-x86_64.so.1
/app # ldd /app/bin/jibcmd
/lib64/ld-linux-x86-64.so.2 (0x7f62a8afa000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f62a8afa000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f62a8afa000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f62a8afa000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /app/bin/jibcmd)