Docker:E:无法找到软件包mysql-client --no-install-recommends [英] Docker: E: Unable to locate package mysql-client —-no-install-recommends

查看:321
本文介绍了Docker:E:无法找到软件包mysql-client --no-install-recommends的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注本教程:这基本上是对此的更新: Laravel + Docker第1部分—开发设置

Which is basically an update of this: Laravel + Docker Part 1 — setup for Development

但是当我跑步

docker-compose up

我收到此错误

E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends  && docker-php-ext-install pdo_mysql' returned a non-zero code: 100

完整输出

Creating network "pulzu_default" with the default driver
Building app
Step 1/2 : FROM php:7.2.2-fpm
 ---> 60245f64ed12
Step 2/2 : RUN apt-get update && apt-get install -y mysql-client —-no-install-recommends  && docker-php-ext-install pdo_mysql
 ---> Running in cefd70564b31
Get:1 http://security.debian.org stretch/updates InRelease [94.3 kB]
Ign:2 http://cdn-fastly.deb.debian.org/debian stretch InRelease
Get:3 http://cdn-fastly.deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:5 http://security.debian.org stretch/updates/main amd64 Packages [468 kB]
Get:4 http://cdn-fastly.deb.debian.org/debian stretch Release [118 kB]
Get:6 http://cdn-fastly.deb.debian.org/debian stretch Release.gpg [2434 B]
Get:7 http://cdn-fastly.deb.debian.org/debian stretch-updates/main amd64 Packages [12.1 kB]
Get:8 http://cdn-fastly.deb.debian.org/debian stretch/main amd64 Packages [9530 kB]
Fetched 10.3 MB in 2s (4142 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package mysql-client —-no-install-recommends
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y mysql-client —-no-install-recommends  && docker-php-ext-install pdo_mysql' returned a non-zero code: 100

有人知道如何解决吗?

推荐答案

图像缺少能够安装mysql-client的依赖项,这是由--no-install-recommends标志引起的.默认情况下,Ubuntu安装推荐但不推荐的软件包.使用--no-install-recommends,仅安装主要依赖项(依赖"字段中的软件包).

The image is missing dependencies to be able to install mysql-client, this is caused by the --no-install-recommends flag. By default, Ubuntu installs recommended but not suggested packages. With --no-install-recommends, only the main dependencies (packages in the Depends field) are installed.

Dockerfile或根据文章app.dockerfile更改为:

FROM php:7.2.2-fpm RUN apt-get update && apt-get install -y mysql-client \ && docker-php-ext-install pdo_mysql

FROM php:7.2.2-fpm RUN apt-get update && apt-get install -y mysql-client \ && docker-php-ext-install pdo_mysql

您应该能够构建映像,因此docker-compose up命令将起作用.

And you should be able to build the image, therefore the docker-compose up command would work.

这篇关于Docker:E:无法找到软件包mysql-client --no-install-recommends的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆