一尘不染

E:软件包“ mysql-client”在使用docker compose的php-fpm映像构建中没有安装候选对象

docker

我是Docker的新手,所以我尝试使用laravel项目了解更多有关Docker的信息,并按照以下教程进行操作:

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

我已经根据教程内容对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

我想念什么吗?

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

谢谢。


阅读 450

收藏
2020-06-17

共1个答案

一尘不染

php:7.3-fpm现在使用Debian 10(Buster)作为其基本映像,并且Buster随MariaDB一起提供,因此只需替换mysql- client为即可mariadb-client修复它。

2020-06-17