]> git.pld-linux.org Git - packages/docker.git/blame - docker.init
setup bigger ulimits like contrib/init
[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
a990be6d
ER
31DOCKER_LOGFILE=/var/log/docker.log
32
345101bd 33# Get service config - may override defaults
47009a45 34[ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
345101bd
ER
35
36pidfile="/var/run/docker.pid"
37
38start() {
39 # Check if the service is already running?
47009a45
ER
40 if [ -f /var/lock/subsys/docker ]; then
41 msg_already_running "Docker"
345101bd
ER
42 return
43 fi
44
c301aaa7
ER
45 # NOTE: docker daemon actually doesn't go to background, need to do that ourselves
46 # https://github.com/docker/docker/issues/2758
47
47009a45 48 msg_starting "Docker"
a990be6d
ER
49
50 export DOCKER_LOGFILE
51 daemon \
52 --fork --pidfile $pidfile --waitfortime 60 \
53 /usr/lib/docker daemon $OPTIONS
9bb76e88 54
345101bd 55 RETVAL=$?
47009a45 56 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
345101bd
ER
57}
58
59stop() {
47009a45
ER
60 if [ ! -f /var/lock/subsys/docker ]; then
61 msg_not_running "Docker"
345101bd
ER
62 return
63 fi
64
65 # Stop daemons.
47009a45 66 msg_stopping "Docker"
b16e11f6 67 killproc --pidfile $pidfile docker
47009a45 68 rm -f /var/lock/subsys/docker
345101bd
ER
69}
70
71condrestart() {
47009a45
ER
72 if [ ! -f /var/lock/subsys/docker ]; then
73 msg_not_running "Docker"
345101bd
ER
74 RETVAL=$1
75 return
76 fi
77
78 stop
79 start
80}
81
82RETVAL=0
83# See how we were called.
84case "$1" in
85 start)
86 start
87 ;;
88 stop)
89 stop
90 ;;
91 restart)
92 stop
93 start
94 ;;
95 try-restart)
96 condrestart 0
97 ;;
98 force-reload)
99 condrestart 7
100 ;;
101 status)
47009a45 102 status --pidfile $pidfile docker docker
345101bd
ER
103 RETVAL=$?
104 ;;
105 *)
106 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
107 exit 3
108esac
109
110exit $RETVAL
This page took 0.081303 seconds and 4 git commands to generate.