Round out systemd for RPM packaging
Signed-off-by: Eli Uriegas <eli.uriegas@docker.com> Upstream-commit: f99ffa4b5ef8c85fa5fbeb8fdc95403f9a02ceaf Component: packaging
This commit is contained in:
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user