Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8261caed
Commit
8261caed
authored
Oct 17, 2014
by
Brendan Burns
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1876 from jbeda/boot2docker-fix
Fix boot2docker with /User mapping.
parents
e04fabdd
e48cbb22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
26 deletions
+24
-26
common.sh
build/common.sh
+24
-26
No files found.
build/common.sh
View file @
8261caed
...
...
@@ -371,42 +371,38 @@ function kube::build::run_build_command() {
docker
rm
"
${
KUBE_BUILD_CONTAINER_NAME
}
"
>
/dev/null 2>&1
||
true
}
# Test if the output directory is remote (and can only be accessed through
# docker) or if it is "local" and we can access the output without going through
# docker.
function
kube::build::is_output_remote
()
{
rm
-f
"
${
LOCAL_OUTPUT_BUILD
}
/test_for_remote"
kube::build::run_build_command
touch
"
${
REMOTE_OUTPUT_DIR
}
/test_for_remote"
[[
!
-e
"
${
LOCAL_OUTPUT_BUILD
}
/test_for_remote"
]]
}
# If the Docker server is remote, copy the results back out.
function
kube::build::copy_output
()
{
if
kube::build::is_osx
;
then
# Docker 1.3 on OS X handles this properly, so bail.
docker_version
=
$(
docker version 2> /dev/null |
sed
-n
1p |
awk
'{ print $3 }'
)
# TODO: this will start breaking with Docker 1.4, but at that point we should
# just delete this whole function and force people to upgrade.
if
[[
"
$docker_version
"
==
"1.3."
*
]]
;
then
return
fi
# When we are on the Mac with boot2docker we need to copy the results back
# out. Ideally we would leave the container around and use 'docker cp' to
# copy the results out. However, that doesn't work for mounted volumes
# currently (https://github.com/dotcloud/docker/issues/1992). And it is
# just plain broken (https://github.com/dotcloud/docker/issues/6483).
if
kube::build::is_output_remote
;
then
# When we are on the Mac with boot2docker (or to a remote Docker in any
# other situation) we need to copy the results back out. Ideally we would
# leave the container around and use 'docker cp' to copy the results out.
# However, that doesn't work for mounted volumes currently
# (https://github.com/dotcloud/docker/issues/1992). And it is just plain
# broken (https://github.com/dotcloud/docker/issues/6483).
#
# The easiest thing I (jbeda) could figure out was to launch another
# container pointed at the same volume, tar the output directory and ship
# that tar over stdou.
local
-ra
docker_cmd
=(
docker run
-a
stdout
"--name=
${
KUBE_BUILD_CONTAINER_NAME
}
"
"
${
DOCKER_MOUNT_ARGS
[@]
}
"
"
${
KUBE_BUILD_IMAGE
}
"
)
# Kill any leftover container
docker
rm
"
${
KUBE_BUILD_CONTAINER_NAME
}
"
>
/dev/null 2>&1
||
true
# that tar over stdout.
echo
"+++ Syncing back _output directory from boot2docker VM"
rm
-rf
"
${
LOCAL_OUTPUT_BUILD
}
"
mkdir
-p
"
${
LOCAL_OUTPUT_BUILD
}
"
"
${
docker_cmd
[@]
}
"
sh
-c
"tar c -C
${
REMOTE_OUTPUT_DIR
}
. ; sleep 1"
\
|
tar
xv
-C
"
${
LOCAL_OUTPUT_BUILD
}
"
#
Remove the container after we run. '--rm' might be appropriate but i
t
#
appears that sometimes it fails. See
# https://github.com/docker/docker/issues/3968
docker
rm
"
${
KUBE_BUILD_CONTAINER_NAME
}
"
>
/dev/null 2>&1
||
true
#
The '</dev/null' here makes us run docker in a "non-interactive" mode. No
t
#
doing this corrupts the output stream.
kube::build::run_build_command sh
-c
"tar c -C
${
REMOTE_OUTPUT_DIR
}
. ; sleep 1"
</dev/null
\
|
tar
xv
-C
"
${
LOCAL_OUTPUT_BUILD
}
"
# I (jbeda) also tried getting rsync working using 'docker run' as the
# 'remote shell'. This mostly worked but there was a hang when
...
...
@@ -415,6 +411,8 @@ function kube::build::copy_output() {
# local DOCKER="docker run -i --rm --name=${KUBE_BUILD_CONTAINER_NAME} ${DOCKER_MOUNT} ${KUBE_BUILD_IMAGE}"
# DOCKER+=" bash -c 'shift ; exec \"\$@\"' --"
# rsync --blocking-io -av -e "${DOCKER}" foo:${REMOTE_OUTPUT_DIR}/ ${LOCAL_OUTPUT_BUILD}
else
echo
"+++ Output directory is local. No need to copy results out."
fi
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment