start-dc.sh 653 B

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