-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker.init
More file actions
executable file
·113 lines (95 loc) · 2.11 KB
/
Copy pathdocker.init
File metadata and controls
executable file
·113 lines (95 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/bin/sh
#
# Create lightweight, portable, self-sufficient containers.
#
# chkconfig: 345 20 80
#
# description: Docker is an open-source project to easily create lightweight, portable, \
# self-sufficient containers from any application. The same container that a \
# developer builds and tests on a laptop can run at scale, in production, on \
# VMs, bare metal, OpenStack clusters, public clouds and more. \
# processname: dockerd
# pidfile: /var/run/docker.pid
#
# Source function library
. /etc/rc.d/init.d/functions
# Get network config
. /etc/sysconfig/network
# Check that networking is up.
if is_yes "${NETWORKING}"; then
if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
msg_network_down "Docker"
exit 1
fi
else
exit 0
fi
DOCKER_LOGFILE=/var/log/docker.log
# Get service config - may override defaults
[ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
pidfile="/var/run/docker.pid"
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/docker ]; then
msg_already_running "Docker"
return
fi
# NOTE: docker daemon actually doesn't go to background, need to do that ourselves
# https://github.com/docker/docker/issues/2758
msg_starting "Docker"
touch "$DOCKER_LOGFILE"
chgrp docker "$DOCKER_LOGFILE"
export DOCKER_LOGFILE
daemon \
--fork --pidfile $pidfile --waitfortime 60 \
/usr/lib/dockerd $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
}
stop() {
if [ ! -f /var/lock/subsys/docker ]; then
msg_not_running "Docker"
return
fi
# Stop daemons.
msg_stopping "Docker"
killproc --pidfile $pidfile dockerd
rm -f /var/lock/subsys/docker
}
condrestart() {
if [ ! -f /var/lock/subsys/docker ]; then
msg_not_running "Docker"
RETVAL=$1
return
fi
stop
start
}
RETVAL=0
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
try-restart)
condrestart 0
;;
force-reload)
condrestart 7
;;
status)
status --pidfile $pidfile dockerd dockerd
RETVAL=$?
;;
*)
msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
exit 3
esac
exit $RETVAL