[我正在尝试将简单的Spring应用程序的映像与Websphere liberty的基本映像安装为Root应用程序。
虽然它是在本地构建的并且运行良好,但是使用Kaniko(由Jenkins使用)构建时,无法正确构建相同的图像。
示例项目-https://github.com/dhananjay12/ci-cd-spring-projectwslc的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'.
有什么建议吗?
问题是/ config是一个符号链接
config -> /opt/ibm/wlp/usr/servers/defaultServer
直接将附件文件添加到/opt/ibm/wlp/usr/servers/defaultServer/apps/
解决了问题