1
0

start-dc.sh 783 B

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