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() {
...
@@ -371,42 +371,38 @@ function kube::build::run_build_command() {
docker
rm
"
${
KUBE_BUILD_CONTAINER_NAME
}
"
>
/dev/null 2>&1
||
true
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.
# If the Docker server is remote, copy the results back out.
function
kube::build::copy_output
()
{
function
kube::build::copy_output
()
{
if
kube::build::is_osx
;
then
if
kube::build::is_output_remote
;
then
# Docker 1.3 on OS X handles this properly, so bail.
# When we are on the Mac with boot2docker (or to a remote Docker in any
docker_version
=
$(
docker version 2> /dev/null |
sed
-n
1p |
awk
'{ print $3 }'
)
# other situation) we need to copy the results back out. Ideally we would
# TODO: this will start breaking with Docker 1.4, but at that point we should
# leave the container around and use 'docker cp' to copy the results out.
# just delete this whole function and force people to upgrade.
# However, that doesn't work for mounted volumes currently
if
[[
"
$docker_version
"
==
"1.3."
*
]]
;
then
# (https://github.com/dotcloud/docker/issues/1992). And it is just plain
return
# broken (https://github.com/dotcloud/docker/issues/6483).
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).
#
#
# The easiest thing I (jbeda) could figure out was to launch another
# The easiest thing I (jbeda) could figure out was to launch another
# container pointed at the same volume, tar the output directory and ship
# container pointed at the same volume, tar the output directory and ship
# that tar over stdou.
# that tar over stdout.
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
echo
"+++ Syncing back _output directory from boot2docker VM"
echo
"+++ Syncing back _output directory from boot2docker VM"
rm
-rf
"
${
LOCAL_OUTPUT_BUILD
}
"
rm
-rf
"
${
LOCAL_OUTPUT_BUILD
}
"
mkdir
-p
"
${
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
#
The '</dev/null' here makes us run docker in a "non-interactive" mode. No
t
#
appears that sometimes it fails. See
#
doing this corrupts the output stream.
# https://github.com/docker/docker/issues/3968
kube::build::run_build_command sh
-c
"tar c -C
${
REMOTE_OUTPUT_DIR
}
. ; sleep 1"
</dev/null
\
docker
rm
"
${
KUBE_BUILD_CONTAINER_NAME
}
"
>
/dev/null 2>&1
||
true
|
tar
xv
-C
"
${
LOCAL_OUTPUT_BUILD
}
"
# I (jbeda) also tried getting rsync working using 'docker run' as the
# I (jbeda) also tried getting rsync working using 'docker run' as the
# 'remote shell'. This mostly worked but there was a hang when
# 'remote shell'. This mostly worked but there was a hang when
...
@@ -415,6 +411,8 @@ function kube::build::copy_output() {
...
@@ -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}"
# local DOCKER="docker run -i --rm --name=${KUBE_BUILD_CONTAINER_NAME} ${DOCKER_MOUNT} ${KUBE_BUILD_IMAGE}"
# DOCKER+=" bash -c 'shift ; exec \"\$@\"' --"
# DOCKER+=" bash -c 'shift ; exec \"\$@\"' --"
# rsync --blocking-io -av -e "${DOCKER}" foo:${REMOTE_OUTPUT_DIR}/ ${LOCAL_OUTPUT_BUILD}
# 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
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