dind 1014 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. set -e
  3. # DinD: a wrapper script which allows docker to be run inside a docker container.
  4. # Original version by Jerome Petazzoni <jerome@docker.com>
  5. # See the blog post: https://blog.docker.com/2013/09/docker-can-now-run-within-docker/
  6. #
  7. # This script should be executed inside a docker container in privileged mode
  8. # ('docker run --privileged', introduced in docker 0.6).
  9. # Usage: dind CMD [ARG...]
  10. # apparmor sucks and Docker needs to know that it's in a container (c) @tianon
  11. export container=docker
  12. if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
  13. mount -t securityfs none /sys/kernel/security || {
  14. echo >&2 'Could not mount /sys/kernel/security.'
  15. echo >&2 'AppArmor detection and --privileged mode might break.'
  16. }
  17. fi
  18. # Mount /tmp (conditionally)
  19. if ! mountpoint -q /tmp; then
  20. mount -t tmpfs none /tmp
  21. fi
  22. if [ $# -gt 0 ]; then
  23. exec "$@"
  24. fi
  25. echo >&2 'ERROR: No command specified.'
  26. echo >&2 'You probably want to run hack/make.sh, or maybe a shell?'