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