docker apt-get install 获取文件失败
docker apt-get install fails fetching a file
我在 DockerFile 中有以下命令
# Use the official image as a parent image.
FROM ubuntu:18.04
#FROM node:10.18.0
# Install Node.js
RUN apt-get update && apt-get install -y \
wget \
build-essential \
software-properties-common
# install node version 10.18, need to use this specific
# version since it is the version that works with mapnik
RUN wget https://nodejs.org/dist/v10.18.0/node-v10.18.0-linux-x64.tar.xz
RUN tar -xJf node-v10.18.0-linux-x64.tar.xz -C /usr/local --strip-components=1 --no-same-owner \
&& rm node-v10.18.0-linux-x64.tar.xz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& node --version \
&& npm --version
# install gdal
RUN add-apt-repository ppa:ubuntugis/ppa
RUN apt-get update && apt-get install -y --no-install-recommends \
gdal-bin \
cmake \
build-essential \
git \
ca-certificates \
libgdal-dev
失败并出现以下错误:
et:151 http://archive.ubuntu.com/ubuntu bionic/main amd64 unixodbc-dev amd64 2.3.4-1.1ubuntu3 [217 kB]
Err:152 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeos-c1v5 amd64 3.7.1-1~bionic0
Could not connect to ppa.launchpad.net:80 (91.189.95.85), connection timed out [IP: 91.189.95.85 80]
Err:153 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 proj-data all 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:154 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libproj13 amd64 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:155 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeotiff2 amd64 1.4.2-2build1+bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:156 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libogdi4.1 amd64 4.1.0+ds-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:157 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libspatialite7 amd64 4.3.0a-5build1+bionic1
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:158 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgdal20 amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:159 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 gdal-bin amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:160 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeos-dev amd64 3.7.1-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:161 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeotiff-dev amd64 1.4.2-2build1+bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:162 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libogdi-dev amd64 4.1.0+ds-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:163 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libproj-dev amd64 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:164 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libspatialite-dev amd64 4.3.0a-5build1+bionic1
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:165 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgdal-dev amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Fetched 61.7 MB in 33s (1896 kB/s)
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/geos/libgeos-c1v5_3.7.1-1~bionic0_amd64.deb Could not connect to ppa.launchpad.net:80 (91.189.95.85), connection timed out [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/proj-data_5.2.0-1~bionic0_all.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/libproj13_5.2.0-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/libg/libgeotiff-dfsg/libgeotiff2_1.4.2-2build1+bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/o/ogdi-dfsg/libogdi4.1_4.1.0+ds-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/s/spatialite/libspatialite7_4.3.0a-5build1+bionic1_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal20_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/gdal-bin_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/geos/libgeos-dev_3.7.1-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/libg/libgeotiff-dfsg/libgeotiff-dev_1.4.2-2build1+bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/o/ogdi-dfsg/libogdi-dev_4.1.0+ds-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/libproj-dev_5.2.0-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/s/spatialite/libspatialite-dev_4.3.0a-5build1+bionic1_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal-dev_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
我可以直接访问文件,例如将此 link 粘贴到浏览器中,http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal-dev_2.4.2+dfsg-1~bionic0_amd64.deb 您将下载文件。
这曾经有效,但现在失败了。有什么想法吗?
在我的例子中,问题是我的 docker 容器没有启用 ipv6,而且有问题的 ppa (ondre/php) 一定已经开始强制执行它。这花了我一周的时间,让我的头撞到了很多墙上。实际上,我 运行 多次重启我的笔记本电脑,导致 Ubuntu 臭名昭著的持续性低亮度错误 - 但那是另一回事了。所以在包扎我的头、小睡、休息和祈祷之后,这就是我解决问题的方法:
资源列在
之后
- 升级 Ubuntu 到最新版本(我认为这是可选的 - 我只是全力以赴)
- 清除并重新安装 Docker 到最新版本(现在是 20)
- 在我的调制解调器上找到我的 ipv6 设置并确保它们正常工作。 (他们是)。基本上,确保 ipv6 在 Docker 主机
上工作
- 停止docker。
systemctl stop docker
- 在
/etc/docker
中创建daemon.json文件并添加以下内容:
{
"data-root": "/home/user/docker/data",
"ipv6": true,
"fixed-cidr-v6": "fd00::/80"
}
最后2个属性是你关注的
- 重新启动 Docker
systemctl start docker
。此时,您应该没有 docker 错误
- 然后,这是关键,通过主机从 docker 个容器启用 ipv6 访问:(主机上的运行)
ip6tables -t nat -A POSTROUTING -s fd00::/80 ! -o docker0 -j MASQUERADE
- 用任何你喜欢的方式坚持#7
资源:
对我来说,特定问题与互联网访问无关,因为 apt-get update 工作正常,gis ppa 在某种程度上被破坏了,坦率地说,你不再需要它与 18.04 LTS 图像,可能是默认的 18.04图片已更新。
删除
RUN add-apt-repository ppa:ubuntugis/ppa
我在 DockerFile 中有以下命令
# Use the official image as a parent image.
FROM ubuntu:18.04
#FROM node:10.18.0
# Install Node.js
RUN apt-get update && apt-get install -y \
wget \
build-essential \
software-properties-common
# install node version 10.18, need to use this specific
# version since it is the version that works with mapnik
RUN wget https://nodejs.org/dist/v10.18.0/node-v10.18.0-linux-x64.tar.xz
RUN tar -xJf node-v10.18.0-linux-x64.tar.xz -C /usr/local --strip-components=1 --no-same-owner \
&& rm node-v10.18.0-linux-x64.tar.xz \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs \
&& node --version \
&& npm --version
# install gdal
RUN add-apt-repository ppa:ubuntugis/ppa
RUN apt-get update && apt-get install -y --no-install-recommends \
gdal-bin \
cmake \
build-essential \
git \
ca-certificates \
libgdal-dev
失败并出现以下错误:
et:151 http://archive.ubuntu.com/ubuntu bionic/main amd64 unixodbc-dev amd64 2.3.4-1.1ubuntu3 [217 kB]
Err:152 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeos-c1v5 amd64 3.7.1-1~bionic0
Could not connect to ppa.launchpad.net:80 (91.189.95.85), connection timed out [IP: 91.189.95.85 80]
Err:153 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 proj-data all 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:154 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libproj13 amd64 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:155 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeotiff2 amd64 1.4.2-2build1+bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:156 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libogdi4.1 amd64 4.1.0+ds-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:157 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libspatialite7 amd64 4.3.0a-5build1+bionic1
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:158 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgdal20 amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:159 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 gdal-bin amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:160 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeos-dev amd64 3.7.1-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:161 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgeotiff-dev amd64 1.4.2-2build1+bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:162 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libogdi-dev amd64 4.1.0+ds-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:163 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libproj-dev amd64 5.2.0-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:164 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libspatialite-dev amd64 4.3.0a-5build1+bionic1
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Err:165 http://ppa.launchpad.net/ubuntugis/ppa/ubuntu bionic/main amd64 libgdal-dev amd64 2.4.2+dfsg-1~bionic0
Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
Fetched 61.7 MB in 33s (1896 kB/s)
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/geos/libgeos-c1v5_3.7.1-1~bionic0_amd64.deb Could not connect to ppa.launchpad.net:80 (91.189.95.85), connection timed out [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/proj-data_5.2.0-1~bionic0_all.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/libproj13_5.2.0-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/libg/libgeotiff-dfsg/libgeotiff2_1.4.2-2build1+bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/o/ogdi-dfsg/libogdi4.1_4.1.0+ds-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/s/spatialite/libspatialite7_4.3.0a-5build1+bionic1_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal20_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/gdal-bin_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/geos/libgeos-dev_3.7.1-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/libg/libgeotiff-dfsg/libgeotiff-dev_1.4.2-2build1+bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/o/ogdi-dfsg/libogdi-dev_4.1.0+ds-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/p/proj/libproj-dev_5.2.0-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/s/spatialite/libspatialite-dev_4.3.0a-5build1+bionic1_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Failed to fetch http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal-dev_2.4.2+dfsg-1~bionic0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.85 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
我可以直接访问文件,例如将此 link 粘贴到浏览器中,http://ppa.launchpad.net/ubuntugis/ppa/ubuntu/pool/main/g/gdal/libgdal-dev_2.4.2+dfsg-1~bionic0_amd64.deb 您将下载文件。
这曾经有效,但现在失败了。有什么想法吗?
在我的例子中,问题是我的 docker 容器没有启用 ipv6,而且有问题的 ppa (ondre/php) 一定已经开始强制执行它。这花了我一周的时间,让我的头撞到了很多墙上。实际上,我 运行 多次重启我的笔记本电脑,导致 Ubuntu 臭名昭著的持续性低亮度错误 - 但那是另一回事了。所以在包扎我的头、小睡、休息和祈祷之后,这就是我解决问题的方法:
资源列在
之后- 升级 Ubuntu 到最新版本(我认为这是可选的 - 我只是全力以赴)
- 清除并重新安装 Docker 到最新版本(现在是 20)
- 在我的调制解调器上找到我的 ipv6 设置并确保它们正常工作。 (他们是)。基本上,确保 ipv6 在 Docker 主机 上工作
- 停止docker。
systemctl stop docker
- 在
/etc/docker
中创建daemon.json文件并添加以下内容:
{
"data-root": "/home/user/docker/data",
"ipv6": true,
"fixed-cidr-v6": "fd00::/80"
}
最后2个属性是你关注的
- 重新启动 Docker
systemctl start docker
。此时,您应该没有 docker 错误 - 然后,这是关键,通过主机从 docker 个容器启用 ipv6 访问:(主机上的运行)
ip6tables -t nat -A POSTROUTING -s fd00::/80 ! -o docker0 -j MASQUERADE
- 用任何你喜欢的方式坚持#7
资源:
对我来说,特定问题与互联网访问无关,因为 apt-get update 工作正常,gis ppa 在某种程度上被破坏了,坦率地说,你不再需要它与 18.04 LTS 图像,可能是默认的 18.04图片已更新。
删除
RUN add-apt-repository ppa:ubuntugis/ppa