未发现软件包 mysql,Docker:E:无法找到软件包mysql-client --no-install-commends

But when I ran

docker-compose up

I got this error

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

A full output

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

Does anyone have any idea how to fix it?

解决方案

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.

Change the Dockerfile or according to the article app.dockerfile to:

FROM php:7.2.2-fpm

RUN apt-get update && apt-get install -y mysql-client \

&& docker-php-ext-install pdo_mysql

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值