summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-09-02 13:17:00 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-09-02 13:17:00 +0000
commit16aa44a1bceba98dbe211b9088ca0611d4ed32e1 (patch)
tree8fa14d5742f18968b670017736262537d39bf577 /start-container-docker.sh
parent22e6957fd2ddc89a61fed9517d1fd57161cfa5b9 (diff)
start-container-docker.sh: Better handle non-home mounts
... by not trying to create directories outside of /home. Change-Id: I466be66f7813af5a4f8a7d4fbbdfa2bc976b564f
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh25
1 files changed, 15 insertions, 10 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index 44a7c200..dd2c30b3 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -246,18 +246,23 @@ fi
bind_mounts_opt=()
for bind_mount in "${bind_mounts[@]}"; do
- # Make sure all bind-mount directories exist.
- # If a host bind-mount dir doesn't exist, then docker creates it on
- # the host with root:root owner, which can't be removed by cleanup job.
dir="${bind_mount%%:*}"
- $dryruncmd $SSH $session_host mkdir -p "$dir"
- 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
+ # Make sure all bind-mount /home/* directories exist.
+ # If a host bind-mount dir doesn't exist, then docker creates it on
+ # the host with root:root owner, which can't be removed by cleanup job.
+ case "$dir" in
+ "/home/"*)
+ $dryruncmd $SSH $session_host mkdir -p "$dir"
+
+ 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
+ ;;
+ esac
bind_mounts_opt=("${bind_mounts_opt[@]}" "-v" "$dir:$bind_mount")
done