Systemd/non-Redhat: Add docker prestart file

We do the equivalent of #21727 for systemd systems.

Issue #21731
This commit is contained in:
Justin Santa Barbara 2016-03-02 09:20:26 -05:00
parent d074b5ba13
commit 64f1cbaddd
3 changed files with 42 additions and 1 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This script is intended to be run before we start Docker.
# cleanup docker network checkpoint to avoid running into known issue
# of docker (https://github.com/docker/docker/issues/18283)
rm -rf /var/lib/docker/network

View File

@ -15,6 +15,7 @@ LimitCORE=infinity
Restart=always
RestartSec=2s
StartLimitInterval=0
ExecStartPre=/opt/kubernetes/helpers/docker-prestart
[Install]
WantedBy=multi-user.target

View File

@ -51,6 +51,13 @@ docker:
{% if pillar.get('is_systemd') %}
/opt/kubernetes/helpers/docker-prestart:
file.managed:
- source: salt://docker/docker-prestart
- user: root
- group: root
- mode: 755
{{ pillar.get('systemd_system_path') }}/docker.service:
file.managed:
- source: salt://docker/docker.service
@ -60,6 +67,8 @@ docker:
- mode: 644
- defaults:
environment_file: {{ environment_file }}
- require:
- file: /opt/kubernetes/helpers/docker-prestart
# The docker service.running block below doesn't work reliably
# Instead we run our script which e.g. does a systemd daemon-reload
@ -292,9 +301,16 @@ docker-upgrade:
- file: /var/cache/docker-install/{{ override_deb }}
{% endif %} # end override_docker_ver != ''
# Default docker systemd unit file doesn't use an EnvironmentFile; replace it with one that does.
{% if pillar.get('is_systemd') %}
/opt/kubernetes/helpers/docker-prestart:
file.managed:
- source: salt://docker/docker-prestart
- user: root
- group: root
- mode: 755
# Default docker systemd unit file doesn't use an EnvironmentFile; replace it with one that does.
{{ pillar.get('systemd_system_path') }}/docker.service:
file.managed:
- source: salt://docker/docker.service
@ -304,6 +320,8 @@ docker-upgrade:
- mode: 644
- defaults:
environment_file: {{ environment_file }}
- require:
- file: /opt/kubernetes/helpers/docker-prestart
# The docker service.running block below doesn't work reliably
# Instead we run our script which e.g. does a systemd daemon-reload