]> git.pld-linux.org Git - packages/docker.git/blame - docker.init
wait for pid to be created
[packages/docker.git] / docker.init
CommitLineData
345101bd
ER
1#!/bin/sh
2#
51de77f0 3# Create lightweight, portable, self-sufficient containers.
345101bd 4#
09414b03 5# chkconfig: 345 20 80
345101bd 6#
51de77f0
ER
7# description: Docker is an open-source project to easily create lightweight, portable, \
8# self-sufficient containers from any application. The same container that a \
9# developer builds and tests on a laptop can run at scale, in production, on \
10# VMs, bare metal, OpenStack clusters, public clouds and more. \
345101bd
ER
11# processname: docker
12# pidfile: /var/run/docker.pid
13#
14
15# Source function library
16. /etc/rc.d/init.d/functions
17
18# Get network config
19. /etc/sysconfig/network
20
21# Check that networking is up.
22if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
47009a45 24 msg_network_down "Docker"
345101bd
ER
25 exit 1
26 fi
27else
28 exit 0
29fi
30
31# Get service config - may override defaults
47009a45 32[ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
345101bd
ER
33
34pidfile="/var/run/docker.pid"
35
36start() {
37 # Check if the service is already running?
47009a45
ER
38 if [ -f /var/lock/subsys/docker ]; then
39 msg_already_running "Docker"
345101bd
ER
40 return
41 fi
42
c301aaa7
ER
43 # NOTE: docker daemon actually doesn't go to background, need to do that ourselves
44 # https://github.com/docker/docker/issues/2758
45
47009a45 46 msg_starting "Docker"
9bb76e88
ER
47 daemon --fork --pidfile $pidfile --waitfortime 60 \
48 /usr/bin/docker daemon $OPTIONS
49
345101bd 50 RETVAL=$?
47009a45 51 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
345101bd
ER
52}
53
54stop() {
47009a45
ER
55 if [ ! -f /var/lock/subsys/docker ]; then
56 msg_not_running "Docker"
345101bd
ER
57 return
58 fi
59
60 # Stop daemons.
47009a45 61 msg_stopping "Docker"
b16e11f6 62 killproc --pidfile $pidfile docker
47009a45 63 rm -f /var/lock/subsys/docker
345101bd
ER
64}
65
66condrestart() {
47009a45
ER
67 if [ ! -f /var/lock/subsys/docker ]; then
68 msg_not_running "Docker"
345101bd
ER
69 RETVAL=$1
70 return
71 fi
72
73 stop
74 start
75}
76
77RETVAL=0
78# See how we were called.
79case "$1" in
80 start)
81 start
82 ;;
83 stop)
84 stop
85 ;;
86 restart)
87 stop
88 start
89 ;;
90 try-restart)
91 condrestart 0
92 ;;
93 force-reload)
94 condrestart 7
95 ;;
96 status)
47009a45 97 status --pidfile $pidfile docker docker
345101bd
ER
98 RETVAL=$?
99 ;;
100 *)
101 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
102 exit 3
103esac
104
105exit $RETVAL
This page took 0.119709 seconds and 4 git commands to generate.