aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests/start-dc.sh
blob: 45fbbfbf0b52d812c798705751709319860eab11 (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
#!/usr/bin/env bash

function getContainerHealth {
  docker inspect --format "{{.State.Health.Status}}" $1
}

function waitContainer {
  while STATUS=$(getContainerHealth $1); [ $STATUS != "healthy" ]; do
    if [ $STATUS == "unhealthy" ]; then
      echo "Failed!" 1>&2
      exit -1
    fi
    printf . 1>&2
    lf=$'\n'
    sleep 1
  done
  printf "$lf" 1>&2
}

docker rm -f dc 2>/dev/null > /dev/null

mkdir -p /tmp/shared

# start the dc
docker run -dit --name dc -v /tmp/shared:/shared --hostname krb.domain.test --cap-add SYS_ADMIN icewind1991/samba-krb-test-dc 1>&2

waitContainer dc

docker inspect dc --format '{{.NetworkSettings.IPAddress}}'