0

我正在尝试构建一个简单的 Spring 应用程序的图像,并将 Websphere 自由的基本图像安装为根应用程序。

虽然它在本地构建并且运行良好,但在使用 Kaniko(由 Jenkins 使用)构建时无法正确构建相同的图像。

示例项目 - https://github.com/dhananjay12/ci-cd-spring-project wslc 的 Docker 文件 - https://github.com/dhananjay12/ci-cd-spring-project/blob/master/Dockerfile-wslc

FROM websphere-liberty:18.0.0.4-javaee7

# Copy war file to apps folder
ADD ./target/ci-cd-spring-project*.war config/apps/ci-cd-spring-project.war

# Define the root context path for application
RUN sed -i "0,/<\/server>/s/<\/server>/    <webApplication contextRoot=\"\/\" location=\"ci-cd-spring-project.war\" \/>\n\n&/" config/server.xml

它在本地构建并运行良好。

从 kaniko 构建时,图像有点损坏,运行时出现以下错误

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: failed to register layer: Error processing tar file(exit status 1): mkdir /config/apps: no such file or directory.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

有什么建议么?

4

1 回答 1

0

问题是 /config 是一个符号链接

config -> /opt/ibm/wlp/usr/servers/defaultServer

直接添加文件即可/opt/ibm/wlp/usr/servers/defaultServer/apps/解决问题

于 2019-11-05T02:14:41.280 回答