1

在我在这里遇到一些以前的问题来 Dockerise 我的 MySQL Kitura SETUP 之后: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 图像来解决这个问题......有什么更好的聪明方法吗?

再次非常感谢您的帮助。

4

1 回答 1

2

我能够更新和增强我的 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" ] 

于 2019-10-04T17:27:26.290 回答