Docker Community Forums

Share and learn in the Docker community.

Ubuntu docker 16.04. apt-get 408 Request Timeout

we are trying to build a Docker image, starting from “ubuntu:16.04”.

The Dockerfile looks like this:

FROM ubuntu:16.04

ENV http_proxy "http://...:8080"
ENV https_proxy "http://...:8080"

# get basic software packages
RUN apt-get update && apt-get -o Dpkg::Options::="--force-overwrite" \
    install -y curl unzip vim patch postgresql locales openjdk-8-jdk tzdata
...

By running:

docker build -t my_image_tag --pull --no-cache my_docker_folder

We got

...
Get:101 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdrm-common all 2.4.91-2~16.04.1 [4764 B]
Err:102 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libdrm2 amd64 2.4.91-2~16.04.1
  408  Request Timeout
Err:103 http://archive.ubuntu.com/ubuntu xenial/main amd64 libedit2 amd64 3.1-20150325-1ubuntu2
  408  Request Timeout
Err:104 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libelf1 amd64 0.165-3ubuntu1.2
  408  Request Timeout
Ign:105 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libglib2.0-data all 2.48.2-0ubuntu4.3
Ign:106 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libicu55 amd64 55.1-7ubuntu0.4
Err:107 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 libsasl2-modules amd64 2.1.26.dfsg1-14ubuntu0.1
  408  Request Timeout
Ign:108 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libxml2 amd64 2.9.3+dfsg1-1ubuntu0.6
Err:109 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 shared-mime-info amd64 1.5-2ubuntu0.2
  408  Request Timeout
Get:110 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 xdg-user-dirs amd64 0.15-2ubuntu6.16.04.1 [61.8 kB]
Get:104 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libelf1 amd64 0.165-3ubuntu1.2 [43.5 kB]
...
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libd/libdrm/libdrm2_2.4.91-2~16.04.1_amd64.deb  408  Request Timeout

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libe/libedit/libedit2_3.1-20150325-1ubuntu2_amd64.deb  408  Request Timeout

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/c/cyrus-sasl2/libsasl2-modules_2.1.26.dfsg1-14ubuntu0.1_amd64.deb  408  Request Timeout

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/s/shared-mime-info/shared-mime-info_1.5-2ubuntu0.2_amd64.deb  408  Request Timeout

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && apt-get -o Dpkg::Options::="--force-overwrite"     install -y curl unzip vim patch postgresql locales openjdk-8-jdk tzdata' returned a non-zero code: 100

So it seems that “apt-get” can not fetch some packages due to “408 Request Timeout”.
We are running it behind a proxy.
Can someone tell me what might be the possible reason?