gpt4 book ai didi

mysql - 无法在docker容器中安装mysql-client

转载 作者:行者123 更新时间:2023-12-02 19:15:46 24 4
gpt4 key购买 nike

我正在尝试运行一个入口点脚本,该脚本要等到mysql数据库准备就绪,就像这两个示例一样:example 1example 2
并按预期失败,并显示消息“找不到mysql”,因此在Dockerfile中,我添加了以下两行:

RUN apt-get update
RUN apt-get install mysql-client
但是我收到一条消息: 软件包“mysql-client”没有安装候选者
因此,我尝试使用 default-mysql-client ,但收到另一个错误: 错误:服务'api'生成失败:命令'/ bin / sh -c apt-get install default-mysql-client'返回非零码:1
然后我尝试使用 mariadb-client ,但仍然收到相同的错误: 错误:服务'api'生成失败:命令'/ bin / sh -c apt-get install default-mysql-client'返回非零码:1
这是我的Dockerfile
FROM tomcat:10.0.0-M7-jdk11-openjdk-buster
COPY . /tmp
RUN cp /tmp/API.war /usr/local/tomcat/webapps
WORKDIR /tmp
RUN apt-get update
RUN apt-get install default-mysql-client
有人有主意吗?

最佳答案

它是固定的,当错误要求我以是或否作出响应时,我只是没有注意错误之前的日志部分,因为它只是没有时间做出响应并立即失败:

Step 5/5 : RUN apt install default-mysql-client
---> Running in 4d5614df0d53


Reading package lists...
Reading state information...
The following additional packages will be installed:
libaio1 libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libmariadb3
libreadline5 libsnappy1v5 libterm-readkey-perl mariadb-client-10.3
mariadb-client-core-10.3 mariadb-common mysql-common
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
The following NEW packages will be installed:
default-mysql-client libaio1 libconfig-inifiles-perl libdbd-mysql-perl
libdbi-perl libmariadb3 libreadline5 libsnappy1v5 libterm-readkey-perl
mariadb-client-10.3 mariadb-client-core-10.3 mariadb-common mysql-common
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 8228 kB of archives.
After this operation, 55.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Abort.
所以我像这样在Dockerfile中添加了“-y”: RUN apt-get install default-mysql-client -y

关于mysql - 无法在docker容器中安装mysql-client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63537233/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com