Merge pull request #13335 from jfrazelle/add-apparmor-unshare-test

add unshare apparmor profile test
This commit is contained in:
Sebastiaan van Stijn
2015-05-26 17:32:45 +02:00
6 changed files with 48 additions and 2 deletions
+1
View File
@@ -5,6 +5,7 @@ set -e
images=(
busybox:latest
hello-world:frozen
jess/unshare:latest
)
if ! docker inspect "${images[@]}" &> /dev/null; then
+11
View File
@@ -27,6 +27,17 @@ if [ -n "$DOCKER_STORAGE_OPTS" ]; then
fi
if [ -z "$DOCKER_TEST_HOST" ]; then
# Start apparmor if it is enabled
if [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
# reset container variable so apparmor profile is applied to process
# see https://github.com/docker/libcontainer/blob/master/apparmor/apparmor.go#L16
export container=""
(
set -x
/etc/init.d/apparmor start
)
fi
export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock" # "pwd" tricks to make sure $DEST is an absolute path, not a relative one
( set -x; exec \
docker --daemon --debug \
+10
View File
@@ -9,3 +9,13 @@ for pidFile in $(find "$DEST" -name docker.pid); do
echo >&2 "warning: PID $pid from $pidFile had a nonzero exit code"
fi
done
if [ -z "$DOCKER_TEST_HOST" ]; then
# Stop apparmor if it is enabled
if [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
(
set -x
/etc/init.d/apparmor stop
)
fi
fi