Skip to content

Commit

Permalink
Round out systemd for RPM packaging
Browse files Browse the repository at this point in the history
Signed-off-by: Eli Uriegas <[email protected]>
  • Loading branch information
seemethere committed Aug 15, 2018
1 parent 481c395 commit f99ffa4
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 51 deletions.
18 changes: 9 additions & 9 deletions common/dockerd.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"image": "${ENGINE_IMAGE}",
"namespace":"docker",
"args": [
"-s", "overlay",
"--containerd", "/run/containerd/containerd.sock",
"--default-runtime", "containerd",
"--add-runtime", "containerd=runc"
],
"scope": "ce"
"image": "docker.io/seemethere/engine-community:0.0.0-20180814124044-678d4b3a6d.x86_64",
"namespace":"docker",
"args": [
"-s", "overlay",
"--containerd", "/run/containerd/containerd.sock",
"--default-runtime", "containerd",
"--add-runtime", "containerd=runc"
],
"scope": "ce"
}
4 changes: 2 additions & 2 deletions containerd.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Common things for containerd functionality

CONTAINERD_PROXY_COMMIT=6615ae0be4014152533a83d44cdf9d3baa600d19
CONTAINERD_SHIM_PROCESS_IMAGE=docker.io/docker/containerd-shim-process:a4d1531
CONTAINERD_PROXY_COMMIT=82ae3d13e91d062dd4853379fe018638023c8da2
CONTAINERD_SHIM_PROCESS_IMAGE=docker.io/docker/containerd-shim-process:ff98a47

# If the docker-containerd.sock is available use that, else use the default containerd.sock
ifeq (,$(wildcard /var/run/docker/containerd/docker-containerd.sock))
Expand Down
2 changes: 1 addition & 1 deletion image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ENGINE_DIR:=$(CURDIR)/../../engine
CLI_DIR:=$(CURDIR)/../../cli
VERSION?=0.0.0-dev
STATIC_VERSION=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
DOCKER_HUB_ORG?=docker
DOCKER_HUB_ORG?=dockereng
ARCH=$(shell uname -m)
ENGINE_IMAGE?=engine-community

Expand Down
2 changes: 2 additions & 0 deletions rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ rpmbuild/SOURCES/docker.service: ../systemd/docker.service
rpmbuild/SOURCES/dockerd.json: ../common/dockerd.json
mkdir -p $(@D)
cp $< $@

# TODO: Figure out a sufficient offline solution
42 changes: 21 additions & 21 deletions rpm/SPECS/docker-ce.spec
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,18 @@ install -D -m 0644 %{_topdir}/SOURCES/dockerd.json $RPM_BUILD_ROOT/etc/container
/etc/containerd-proxy/dockerd.json

%pre
if [ $1 -gt 0 ] ; then
# package upgrade scenario, before new files are installed

# clear any old state
rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :

# check if docker service is running
if systemctl is-active docker > /dev/null 2>&1; then
systemctl stop docker > /dev/null 2>&1 || :
touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
fi
fi
# if [ $1 -gt 0 ] ; then
# # package upgrade scenario, before new files are installed
#
# # clear any old state
# rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
#
# # check if docker service is running
# if systemctl is-active docker > /dev/null 2>&1; then
# systemctl stop docker > /dev/null 2>&1 || :
# touch %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
# fi
# fi

%post
%systemd_post docker
Expand All @@ -99,14 +99,14 @@ fi
%systemd_postun_with_restart docker

%posttrans
if [ $1 -ge 0 ] ; then
# package upgrade scenario, after new files are installed

# check if docker was running before upgrade
if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then
systemctl start docker > /dev/null 2>&1 || :
rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
fi
fi
# if [ $1 -ge 0 ] ; then
# # package upgrade scenario, after new files are installed
#
# # check if docker was running before upgrade
# if [ -f %{_localstatedir}/lib/rpm-state/docker-is-active ]; then
# systemctl start docker > /dev/null 2>&1 || :
# rm -f %{_localstatedir}/lib/rpm-state/docker-is-active > /dev/null 2>&1 || :
# fi
# fi

%changelog
24 changes: 6 additions & 18 deletions systemd/docker.service
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,16 @@ After=network-online.target firewalld.service containerd.service
Wants=network-online.target containerd.service

[Service]
Type=notify
# Install containerd-shim-process if it's not already installed
ExecStartPre=/usr/libexec/containerd-offline-installer /var/lib/containerd/containerd-shim-process.tar docker.io/docker/containerd-shim-process
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
TimeoutSec=infinity
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
Restart=always
Delegate=yes
# On RPM Based distributions PATH isn't defined so we define it here
# /opt/containerd/bin is in front so dockerd grabs the correct runc binary
Environment="PATH=/opt/containerd/bin:/sbin:/usr/bin:/usr/local/bin:$PATH"

[Install]
WantedBy=multi-user.target

0 comments on commit f99ffa4

Please sign in to comment.