使用官方镜像php:5.6-fpm,修改/etc/apt/sources.list文件的源后apt-get update提示如下:
使用的源为:
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
补充下面的错误信息:
Reading package lists... Done
W: The repository 'http://mirrors.aliyun.com/debian stretch Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://mirrors.aliyun.com/debian-security stretch/updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: The repository 'http://mirrors.aliyun.com/debian stretch-updates Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://mirrors.aliyun.com/debian/dists/stretch/main/source/Sources SECURITY: URL redirect target contains control characters, rejecting. [IP: 117.21.230.243 80]
E: Failed to fetch http://mirrors.aliyun.com/debian-security/dists/stretch/updates/main/source/Sources SECURITY: URL redirect target contains control characters, rejecting. [IP: 117.21.230.243 80]
E: Failed to fetch http://mirrors.aliyun.com/debian/dists/stretch-updates/contrib/source/Sources SECURITY: URL redirect target contains control characters, rejecting. [IP: 117.21.230.243 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
Debian stretch (Debian 9) 已经撤掉了这些Component,因为已经是oldstable了,所以并没有这么多Component可供使用,你直接照抄肯定出错。
在docker中不要照抄那些仓库,很多docker镜像用的并不一定是最新版本的Debian/Ubuntu,不能保证这么多的Component可以使用,因此你要使用国内镜像的话应该替换掉
/etc/apt/sources.list
中官方仓库地址即可,参考命令:重新运行一个新的容器执行上面的命令替换镜像仓库即可。