3 # Create lightweight, portable, self-sufficient containers.
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. \
12 # pidfile: /var/run/docker.pid
15 # Source function library
16 . /etc/rc.d/init.d/functions
19 . /etc/sysconfig/network
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24 msg_network_down "Docker"
31 DOCKER_LOGFILE=/var/log/docker.log
33 # Get service config - may override defaults
34 [ -f /etc/sysconfig/docker ] && . /etc/sysconfig/docker
36 pidfile="/var/run/docker.pid"
39 # Check if the service is already running?
40 if [ -f /var/lock/subsys/docker ]; then
41 msg_already_running "Docker"
45 # NOTE: docker daemon actually doesn't go to background, need to do that ourselves
46 # https://github.com/docker/docker/issues/2758
50 touch "$DOCKER_LOGFILE"
51 chgrp docker "$DOCKER_LOGFILE"
55 --fork --pidfile $pidfile --waitfortime 60 \
56 /usr/lib/docker daemon $OPTIONS
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/docker
63 if [ ! -f /var/lock/subsys/docker ]; then
64 msg_not_running "Docker"
70 killproc --pidfile $pidfile docker
71 rm -f /var/lock/subsys/docker
75 if [ ! -f /var/lock/subsys/docker ]; then
76 msg_not_running "Docker"
86 # See how we were called.
105 status --pidfile $pidfile docker docker
109 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"