Skip to content

Commit 2f0d3bb

Browse files
ci/Dockerfile: Warn if ulimit -n is too high when running Docker
The underlying issue does not affect our CI hosts, but is an issue on my development machine (Arch Linux). In particular, this affects the vanilla configuration of Docker on systemd, which has effectively no limit: https://github.com/docker/packaging/blob/11400a3f5a20f2e3eecc3e6347a2ad9ce41278c7/pkg/docker-engine/common/systemd/docker.service#L31 I hope this saves future generations some precious hours of their life.
1 parent 4b8a647 commit 2f0d3bb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

ci/linux-debian.Dockerfile

+11-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ FROM debian:stable-slim
22

33
SHELL ["/bin/bash", "-c"]
44

5+
WORKDIR /root
6+
7+
# A too high maximum number of file descriptors (with the default value
8+
# inherited from the docker host) can cause issues with some of our tools:
9+
# - sanitizers hanging: https://github.com/google/sanitizers/issues/1662
10+
# - valgrind crashing: https://stackoverflow.com/a/75293014
11+
# This is not be a problem on our CI hosts, but developers who run the image
12+
# on their machines may run into this (e.g., on Arch Linux), so warn them.
13+
# (Note that .bashrc is only executed in interactive bash shells.)
14+
RUN echo 'if [[ $(ulimit -n) -gt 200000 ]]; then echo "WARNING: Very high value reported by \"ulimit -n\". Consider passing \"--ulimit nofile=32768\" to \"docker run\"."; fi' >> /root/.bashrc
15+
516
RUN dpkg --add-architecture i386 && \
617
dpkg --add-architecture s390x && \
718
dpkg --add-architecture armhf && \
@@ -24,8 +35,6 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
2435
gcc-mingw-w64-i686-win32 wine32 \
2536
python3
2637

27-
WORKDIR /root
28-
2938
# Build and install gcc snapshot
3039
ARG GCC_SNAPSHOT_MAJOR=14
3140
RUN mkdir gcc && cd gcc && \

0 commit comments

Comments
 (0)