在我之前有一些问题要Dockerise我的MySQL Kitura安装程序之后:Docker Build Kitura Sqift Container - Shim.h mysql.h file not found

我遇到了一个新问题,我无法按照以下指南解决问题:https://www.kitura.io/docs/deploying/docker.html

在遵循所有步骤并在以前也解决了MySQL问题之后,我现在能够运行以下命令:

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

但是,这导致以下问题:
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

我认为有些尝试再次尝试从错误的环境目录中打开libmysqclclient?

但是我该如何通过构建docker镜像来解决此问题...是否有任何方法并且更好的智能方法呢?

再次非常感谢您的帮助。

最佳答案

我能够更新和增强我的dockerfile,该文件现在可以正常运行,也可以用于CI和CD任务。


    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" ]

08-28 09:30