apt-配置网络timeout时间

方法1

命令行参数直接指定: apt-get -o Acquire::http::Timeout="300" update

方法2

vi /etc/apt/apt.conf.d/99timeout

将如下内容拷贝进去,单位是秒

1
2
Acquire::http::Timeout "300";
Acquire::ftp::Timeout "300";

Dock

Dockfile

1
2
3
4
5
6
7
8
FROM ubuntu:18.04

RUN /bin/echo -e "Acquire::http::Timeout \"300\";\n\
Acquire::ftp::Timeout \"300\";" >> /etc/apt/apt.conf.d/99timeout

RUN rm -rf /var/lib/apt/lists/* \
    && apt-get update \
    && apt-get -y install wget