diff --git a/cpython-unix/base.Dockerfile b/cpython-unix/base.Dockerfile index 76811a5a..58016550 100644 --- a/cpython-unix/base.Dockerfile +++ b/cpython-unix/base.Dockerfile @@ -33,4 +33,12 @@ RUN ( echo 'amd64'; \ echo 'i386'; \ ) > /var/lib/dpkg/arch -RUN apt-get update +# apt iterates all available file descriptors up to rlim_max and calls +# fcntl(fd, F_SETFD, FD_CLOEXEC). This can result in millions of system calls +# (we've seen 1B in the wild) and cause operations to take seconds to minutes. +# Setting a fd limit mitigates. +# +# Attempts at enforcing the limit globally via /etc/security/limits.conf and +# /root/.bashrc were not successful. Possibly because container image builds +# don't perform a login or use a shell the way we expect. +RUN ulimit -n 10000 && apt-get update diff --git a/cpython-unix/build.Dockerfile b/cpython-unix/build.Dockerfile index af077c6b..09e37fab 100644 --- a/cpython-unix/build.Dockerfile +++ b/cpython-unix/build.Dockerfile @@ -10,7 +10,7 @@ # Compression packages are needed to extract archives. # # Various other build tools are needed for various building. -RUN apt-get install \ +RUN ulimit -n 10000 && apt-get install \ bzip2 \ file \ libc6-dev \ diff --git a/cpython-unix/gcc.Dockerfile b/cpython-unix/gcc.Dockerfile index ea6d1030..f3b76ade 100644 --- a/cpython-unix/gcc.Dockerfile +++ b/cpython-unix/gcc.Dockerfile @@ -1,5 +1,5 @@ {% include 'base.Dockerfile' %} -RUN apt-get install \ +RUN ulimit -n 10000 && apt-get install \ autoconf \ automake \ bison \ diff --git a/cpython-unix/xcb.Dockerfile b/cpython-unix/xcb.Dockerfile index 0480ecae..33d350e2 100644 --- a/cpython-unix/xcb.Dockerfile +++ b/cpython-unix/xcb.Dockerfile @@ -1,3 +1,3 @@ {% include 'build.Dockerfile' %} -RUN apt-get install \ +RUN ulimit -n 10000 && apt-get install \ python