gpt4 book ai didi

laravel - E : Package 'mysql-client' has no installation candidate in php-fpm image build using docker compose

转载 作者:IT老高 更新时间:2023-10-28 12:40:51 25 4
gpt4 key购买 nike

我对 docker 很陌生,所以我尝试使用 laravel 项目了解更多关于它的信息,我正在关注本教程:

https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose

我已经根据教程的内容稍微调整了 Dockerfile,但即使是教程文件也会导致相同的结果。

FROM php:7.3-fpm

# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Install dependencies
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
apt-get update && apt-get install -y mysql-client \


RUN npm install -g npm

# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*


# Install extensions
RUN docker-php-ext-install pdo pdo_mysql

# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www

# Copy existing application directory contents
COPY . /var/www

# Copy existing application directory permissions
COPY --chown=www:www . /var/www

# Change current user to www
USER www
# Set working directory
WORKDIR /var/www
# Expose port 9000 and start php-fpm server
EXPOSE 9000

CMD ["php-fpm"]

但是当我运行 docker-compose up -d 时,我不断收到以下错误:

E: Package 'mysql-client' has no installation candidate
ERROR: Service 'app' failed to build: The command '/bin/sh -c curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get update && apt-get install -y mysql-client nodejs build-essential vim git curl' returned a non-zero code: 100

我错过了什么吗?

我希望这可以工作,因为我在安装 mysql-client 之前正在运行 apt-get update

谢谢。

最佳答案

php:7.3-fpm 现在使用 Debian 10 (Buster) 作为它的 base image并且 Buster 附带 MariaDB,因此只需将 mysql-client 替换为 mariadb-client 即可修复它。

关于laravel - E : Package 'mysql-client' has no installation candidate in php-fpm image build using docker compose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57048428/

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