1
0
mirror of https://github.com/docker/cli.git synced 2026-01-18 08:21:31 +03:00

Merge pull request #13 from seemethere/add_systemd_files

Add systemd scripts
Upstream-commit: 9c1135df05c6ae371da5879d8a1be88749a2bfbd
Component: packaging
This commit is contained in:
Andrew Hsu
2017-06-15 01:02:43 -07:00
committed by GitHub
10 changed files with 99 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ ubuntu-xenial: ## build ubuntu xenial deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -42,6 +43,7 @@ ubuntu-trusty: ## build ubuntu trusty deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -53,6 +55,7 @@ ubuntu-yakkety: ## build ubuntu yakkety deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -64,6 +67,7 @@ ubuntu-zesty: ## build ubuntu zesty deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -75,6 +79,7 @@ debian-jessie: ## build debian jessie deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -86,6 +91,7 @@ debian-stretch: ## build debian stretch deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@
@@ -97,5 +103,6 @@ debian-wheezy: ## build debian wheezy deb packages
-v $(CURDIR)/debbuild/$@:/build \
-v $(ENGINE_DIR):/engine \
-v $(CLI_DIR):/cli \
-v $(CURDIR)/systemd:/root/build-deb/systemd \
debbuild-$@/$(ARCH)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@

View File

@@ -5,8 +5,8 @@ engine/contrib/*-integration usr/share/docker-ce/contrib/
engine/contrib/check-config.sh usr/share/docker-ce/contrib/
engine/contrib/completion/fish/docker.fish usr/share/fish/vendor_completions.d/
engine/contrib/completion/zsh/_docker usr/share/zsh/vendor-completions/
engine/contrib/init/systemd/docker.service lib/systemd/system/
engine/contrib/init/systemd/docker.socket lib/systemd/system/
systemd/docker.service lib/systemd/system/
systemd/docker.socket lib/systemd/system/
engine/contrib/mk* usr/share/docker-ce/contrib/
engine/contrib/nuke-graph-directory.sh usr/share/docker-ce/contrib/
engine/contrib/syntax/nano/Dockerfile.nanorc usr/share/nano/

View File

@@ -0,0 +1,34 @@
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service
Wants=network-online.target
Requires=docker.socket
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd://
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
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
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,12 @@
[Unit]
Description=Docker Socket for the API
PartOf=docker.service
[Socket]
ListenStream=/var/run/docker.sock
SocketMode=0660
SocketUser=root
SocketGroup=docker
[Install]
WantedBy=sockets.target

View File

@@ -11,7 +11,8 @@ RPMBUILD=docker run --privileged --rm -i \
-v $(CURDIR)/rpmbuild/BUILD:/root/rpmbuild/BUILD \
-v $(CURDIR)/rpmbuild/BUILDROOT:/root/rpmbuild/BUILDROOT \
-v $(CURDIR)/rpmbuild/RPMS:/root/rpmbuild/RPMS \
-v $(CURDIR)/rpmbuild/SRPMS:/root/rpmbuild/SRPMS
-v $(CURDIR)/rpmbuild/SRPMS:/root/rpmbuild/SRPMS \
-v $(CURDIR)/systemd:/systemd
RPMBUILD_FLAGS=-ba\
--define '_gitcommit $(word 3,$(GEN_RPM_VER))' \
--define '_release $(word 2,$(GEN_RPM_VER))' \

View File

@@ -95,7 +95,7 @@ install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconf
install -d $RPM_BUILD_ROOT/etc/sysconfig
install -d $RPM_BUILD_ROOT/%{_initddir}
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 engine/contrib/init/systemd/docker.service.rpm $RPM_BUILD_ROOT/%{_unitdir}/docker.service
install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
# add bash, zsh, and fish completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions
@@ -164,4 +164,3 @@ fi
%changelog
* Wed May 10 2017 <andrewhsu@docker.com> 17.06.0-dev
- Initial RPM release

View File

@@ -95,7 +95,7 @@ install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconf
install -d $RPM_BUILD_ROOT/etc/sysconfig
install -d $RPM_BUILD_ROOT/%{_initddir}
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 engine/contrib/init/systemd/docker.service.rpm $RPM_BUILD_ROOT/%{_unitdir}/docker.service
install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
# add bash, zsh, and fish completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions

View File

@@ -94,7 +94,7 @@ install -p -m 644 engine/contrib/udev/80-docker.rules $RPM_BUILD_ROOT/%{_sysconf
install -d $RPM_BUILD_ROOT/etc/sysconfig
install -d $RPM_BUILD_ROOT/%{_initddir}
install -d $RPM_BUILD_ROOT/%{_unitdir}
install -p -m 644 engine/contrib/init/systemd/docker.service.rpm $RPM_BUILD_ROOT/%{_unitdir}/docker.service
install -p -m 644 /systemd/docker.service $RPM_BUILD_ROOT/%{_unitdir}/docker.service
# add bash, zsh, and fish completions
install -d $RPM_BUILD_ROOT/usr/share/bash-completion/completions
install -d $RPM_BUILD_ROOT/usr/share/zsh/vendor-completions

View File

@@ -5,6 +5,11 @@ VERSION=$2
[[ $# < 2 ]] && echo 'not enough args' && exit 1
DATE_COMMAND="date"
if [[ $(uname) -eq "Darwin" ]]; then
DATE_COMMAND="docker run --rm alpine date"
fi
GIT_COMMAND="git -C $ENGINE_DIR"
rpmName=docker-ce
rpmVersion="$VERSION"
@@ -32,7 +37,7 @@ fi
# if we have a "-dev" suffix or have change in Git, let's make this package version more complex so it works better
if [[ "$rpmVersion" == *-dev ]] || [ -n "$($GIT_COMMAND status --porcelain)" ]; then
gitUnix="$($GIT_COMMAND log -1 --pretty='%at')"
gitDate="$(date --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
gitDate="$($DATE_COMMAND --date "@$gitUnix" +'%Y%m%d.%H%M%S')"
gitCommit="$($GIT_COMMAND log -1 --pretty='%h')"
gitVersion="${gitDate}.git${gitCommit}"
# gitVersion is now something like '20150128.112847.17e840a'

View File

@@ -0,0 +1,33 @@
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
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
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target