1
0

start-dc.sh 660 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env bash
  2. set -e
  3. function getContainerHealth {
  4. docker inspect --format "{{.State.Health.Status}}" $1
  5. }
  6. function waitContainer {
  7. while STATUS=$(getContainerHealth $1); [ $STATUS != "healthy" ]; do
  8. if [ $STATUS == "unhealthy" ]; then
  9. echo "Failed!" 1>&2
  10. exit -1
  11. fi
  12. printf . 1>&2
  13. lf=$'\n'
  14. sleep 1
  15. done
  16. printf "$lf" 1>&2
  17. }
  18. docker rm -f dc 2>/dev/null > /dev/null
  19. mkdir -p /tmp/shared
  20. # start the dc
  21. docker run -dit --name dc -v /tmp/shared:/shared --hostname krb.domain.test --cap-add SYS_ADMIN icewind1991/samba-krb-test-dc 1>&2
  22. waitContainer dc
  23. docker inspect dc --format '{{.NetworkSettings.IPAddress}}'