在docker build过程中执行apt-get update时报错"Could not connect to archive.ubuntu.com:80"如何处理?

Posted Jello

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在docker build过程中执行apt-get update时报错"Could not connect to archive.ubuntu.com:80"如何处理?相关的知识,希望对你有一定的参考价值。

答: 在Dockerfile中添加以下语句来配置apt-get

  • 从当前的系统中复制/etc/apt/sources.list以及/etc/apt/apt.conf到Dockerfile所处的目录中
$ cp /etc/apt/sources.list ./
$ cp /etc/apt.conf ./
  • 将以下语句加入Dockerfile中
$ cat Dockerfile
COPY sources.list /etc/apt/sources.list
COPY apt.conf /etc/apt/apt.conf

以上是关于在docker build过程中执行apt-get update时报错"Could not connect to archive.ubuntu.com:80"如何处理?的主要内容,如果未能解决你的问题,请参考以下文章

dockerfile build apt-get update 期间出错 [重复]

在 GitLab-ci Docker build 中执行外部 bash 脚本

Dockerfile的理解

docker中安装hadoop过程及错误解决

Docker容器中安装新的程序

docker build 在 jhipster 中失败