c9830236 |
#!/bin/bash |
b1fe1797 |
set -e |
c9830236 |
|
3c80bd76 |
# DinD: a wrapper script which allows docker to be run inside a docker container. |
b3ee9ac7 |
# Original version by Jerome Petazzoni <jerome@docker.com> |
723d4338 |
# See the blog post: https://blog.docker.com/2013/09/docker-can-now-run-within-docker/ |
3c80bd76 |
#
# This script should be executed inside a docker container in privilieged mode |
44fe8cbb |
# ('docker run --privileged', introduced in docker 0.6). |
3c80bd76 |
# Usage: dind CMD [ARG...]
|
de191e86 |
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
export container=docker
|
b1fe1797 |
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
mount -t securityfs none /sys/kernel/security || {
echo >&2 'Could not mount /sys/kernel/security.' |
4e899d64 |
echo >&2 'AppArmor detection and --privileged mode might break.' |
b1fe1797 |
} |
31638ab2 |
fi
|
b8bed883 |
# Mount /tmp (conditionally)
if ! mountpoint -q /tmp; then
mount -t tmpfs none /tmp
fi |
34eab428 |
|
b1fe1797 |
if [ $# -gt 0 ]; then
exec "$@"
fi
echo >&2 'ERROR: No command specified.'
echo >&2 'You probably want to run hack/make.sh, or maybe a shell?' |