swiftdockerkitura

Run Kitura Docker Image causes libmysqlclient.so.18 Error


after i had some previous problem to Dockerise my MySQL Kitura SETUP here : Docker Build Kitura Sqift Container - Shim.h mysql.h file not found

I am running in a new Problem i can not solve following the Guide from : https://www.kitura.io/docs/deploying/docker.html .

After i followed all the steps and also did the fixing on the MySQL issue previously i was now able to run the following command :

docker run -p 8080:8080 -it myapp-run

THis however leads to the following issue :

error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

i assume something tries again to open the libmysqclclient from some wrong Environmental Directories ?

But how can i fix this issues by building the docker images ... is there any way and better a smart way ?

Thanks a lot again for the help.


Solution

  • I was able to update and enhance my dockerfile this is now running smoothly and also can be used for CI and CD tasks.

    
        FROM ibmcom/swift-ubuntu-runtime:latest
        ##FROM ibmcom/swift-ubuntu-runtime:5.0.1
    
        LABEL maintainer="IBM Swift Engineering at IBM Cloud"
        LABEL Description="Template Dockerfile that extends the ibmcom/swift-ubuntu-runtime image."
    
        # We can replace this port with what the user wants
        EXPOSE 8080
    
        # Default user if not provided
        ARG bx_dev_user=root
        ARG bx_dev_userid=1000
    
        # Install system level packages
        RUN apt-get update && apt-get dist-upgrade -y
        RUN apt-get update && apt-get install -y sudo libmysqlclient-dev
    
        # Add utils files
        ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/run-utils.sh /swift-utils/run-utils.sh
        ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/common-utils.sh /swift-utils/common-utils.sh
        RUN chmod -R 555 /swift-utils
    
        # Create user if not root
        RUN if [ $bx_dev_user != "root" ]; then useradd -ms /bin/bash -u $bx_dev_userid $bx_dev_user; fi
    
        # Bundle application source & binaries
        COPY ./.build /swift-project/.build
    
        # Command to start Swift application
        CMD [ "sh", "-c", "cd /swift-project && .build/release/Beautylivery_Server_New" ]