Search code examples
dockerjenkinsdockerfilewebsphere-libertykaniko

Unable to build run docker image (based on Webshpere liberty) using Kaniko


I am trying to build an image of a simple Spring app with base image of Websphere liberty installed as a Root application.

While it builds locally and runs fine, the same image is not built properly when building using Kaniko (used by Jenkins).

Sample project - https://github.com/dhananjay12/ci-cd-spring-project Docker file for wslc - 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

Locally it builds and runs fine.

While building from kaniko, the image is sort of corrupted and while running I get the following error

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'.

Any suggestions?


Solution

  • The problem was that /config was a symlink

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

    Addin files directly to /opt/ibm/wlp/usr/servers/defaultServer/apps/ solved the problem