summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-08-27 14:17:57 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-08-29 06:11:08 +0000
commit518197a4f4f4ae0ef81986039b5ff98152542be5 (patch)
treeccede098798184edc5e72ca41cef62716be3797d /start-container-docker.sh
parent43a545bf1baf2da7642e43fb175ecb9a7f584d90 (diff)
start-container-docker.sh: Fix container startup on remote target
Fix conversion of bind-mount paths for remote host-container-enabled targets. At the moment we check whether current machine is host-container-enabled (and convert paths), rather than the target. Change-Id: Iccb48cc9533d9674a00064c55c47751f8e115ffc
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh16
1 files changed, 14 insertions, 2 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index db705c68..6e1858bb 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -239,6 +239,12 @@ fi
bind_mounts=($(print_bind_mounts "$task"))
+docker_root=""
+if $SSH $session_host test -f "/.dockerenv" \
+ && $SSH $session_host mount | grep -q "/run/docker.sock "; then
+ docker_root=$($DOCKER info | grep "Docker Root Dir:" | cut -d: -f 2)
+fi
+
bind_mounts_opt=()
for bind_mount in "${bind_mounts[@]}"; do
# Make sure all bind-mount directories exist.
@@ -247,8 +253,14 @@ for bind_mount in "${bind_mounts[@]}"; do
dir="${bind_mount%%:*}"
$SSH $session_host mkdir -p "$dir"
- docker_dir=$(print_docker_path "$dir")
- bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$docker_dir:$bind_mount")
+ if [ x"$docker_root" != x"" ]; then
+ # If inside "host" container (with proxied docker and /home from
+ # host-home volume), convert paths to refer to volume's path on
+ # bare-metal.
+ dir=$(echo "$dir" | sed -e "s#^/home/#$docker_root/volumes/host-home/_data/#")
+ fi
+
+ bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$dir:$bind_mount")
done
volume_mounts=($(print_volume_mounts "$job_name" "-$container_arch-$distro"))