summaryrefslogtreecommitdiff
path: root/salt/openbook/ansible/files/docker-registry.ubuntu
blob: cd2e6768ab23261f3cc2b1254836cbd6f2af64a7 (plain)
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
#!/bin/sh
set -e

### BEGIN INIT INFO
# Provides:           docker-registry
# Required-Start:     $docker
# Required-Stop:      $docker
# Default-Start:      2 3 4 5
# Default-Stop:       0 1 6
# Short-Description:  Docker Registry
# Description:
#  Docker Registry
### END INIT INFO

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

do_start() {
    docker-compose -f /root/docker-registry/docker-compose.yaml up -d
}

do_stop() {
    docker-compose -f /root/docker-registry/docker-compose.yaml stop
    docker-compose -f /root/docker-registry/docker-compose.yaml rm -f
}

do_status() {
    docker-compose -f /root/docker-registry/docker-compose.yaml ps
}

case $1 in
    start*)
        do_start
        ;;
    stop*)
        do_stop
        ;;
    restart*)
        do_stop
        do_start
        ;;
    status*)
        do_status
        ;;
esac