From 1078eddf1161786e54225fbf3ecfa972b46b0450 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Thu, 12 Feb 2015 15:49:57 -0700 Subject: [PATCH] Allow symlinks in the container build This patch permits symlinks in the docker build. Normally docker does not permit symlinked files in the build context sent to the docker server. To work around this problem, a secure directory is created in /tmp and the container contents are copied to that directory. Any symlinks are turned into their non-symlinked equivalents. Change-Id: I38cd5aeed4c73b90449354a0979fc6ddf7891ccb Implements-blueprint: linked-build --- tools/build-docker-image | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/build-docker-image b/tools/build-docker-image index ac12776213..82d210d0ce 100755 --- a/tools/build-docker-image +++ b/tools/build-docker-image @@ -88,10 +88,14 @@ if [ "$MODE" = "release" ]; then echo fi -if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $IMGDIR; then +TMPDIR=$(mktemp -d /tmp/output.XXXXXXXXXX) +cp -aL $IMGDIR/* $TMPDIR + +if ! docker build ${BUILDFLAGS} -t "$FULLIMAGE" $TMPDIR; then echo "ERROR: failed to build $FULLIMAGE" exit 1 fi +rm -rf $TMPDIR echo "Built: $FULLIMAGE"