Skip to content

Commit ea716e3

Browse files
committed
rpm: patch RLIMIT_NOFILE for EL 7 systems
RLIMIT_NOFILE defaults to an unusable value on EL 7 systems, but more modern systems have sane defaults. As such, patch the systemd unit only on EL 7 systems to ensure correct behaviour. Signed-off-by: Bjorn Neergaard <[email protected]>
1 parent 022ee4a commit ea716e3

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

rpm/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ $(DISTROS): sources
9292

9393
.PHONY: sources
9494
sources: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/buildx.tgz rpmbuild/SOURCES/compose.tgz
95+
sources: rpmbuild/SOURCES/01-rlimit_nofile-rhel7.patch
96+
97+
rpmbuild/SOURCES/%.patch:
98+
cp $(CURDIR)/$@ $(@D)
9599

96100
rpmbuild/SOURCES/engine.tgz:
97101
mkdir -p $(@D)

rpm/SPECS/docker-ce.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Version: %{_version}
55
Release: %{_release}%{?dist}
66
Epoch: 3
77
Source0: engine.tgz
8+
Patch0: 01-rlimit_nofile-rhel7.patch
89
Summary: The open-source application container engine
910
Group: Tools/Docker
1011
License: ASL 2.0
@@ -71,6 +72,9 @@ depending on a particular stack or provider.
7172

7273
%prep
7374
%setup -q -c -n src -a 0
75+
%if 0%{?rhel} == 7
76+
%patch -p1 -P 0
77+
%endif
7478

7579
%build
7680

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git i/contrib/init/systemd/docker.service w/contrib/init/systemd/docker.service
2+
index d8c7867057..b73ecf7363 100644
3+
--- i/contrib/init/systemd/docker.service
4+
+++ w/contrib/init/systemd/docker.service
5+
@@ -30,6 +30,10 @@ StartLimitInterval=60s
6+
# in the kernel. We recommend using cgroups to do container-local accounting.
7+
LimitNPROC=infinity
8+
LimitCORE=infinity
9+
+# Older systemd versions default to a LimitNOFILE of 1024:1024, which is insufficient for many
10+
+# applications including dockerd itself and will be inherited. Raise the hard limit, while
11+
+# preserving the soft limit for select(2).
12+
+LimitNOFILE=1024:524288
13+
14+
# Comment TasksMax if your systemd version does not support it.
15+
# Only systemd 226 and above support this option.

0 commit comments

Comments
 (0)