From 7f82029aa66c68f17a7a662e8516f874669f6e0a Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Thu, 19 Mar 2020 18:53:33 +0100 Subject: [PATCH] new: [compose] use host's docker and ssh config on linux os Signed-off-by: Valentin Lab --- bin/compose | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bin/compose b/bin/compose index 563c56d..f434fdc 100755 --- a/bin/compose +++ b/bin/compose @@ -827,8 +827,14 @@ mk_docker_run_options() { "-e" "HOST_CONFIGSTORE=$CONFIGSTORE" ) - - #docker_run_opts+=("-v" "$HOME/.docker:/root/.docker") + if [ "$OS" == "linux" ]; then + [ -d "$HOME/.docker" ] && \ + docker_run_opts+=("-v" "$HOME/.docker:/root/.docker:ro") + [ -d "$HOME/.ssh" ] && \ + docker_run_opts+=("-v" "$HOME/.ssh:/root/.ssh:ro") + [ -d "/etc/ssh" ] && \ + docker_run_opts+=("-v" "/etc/ssh:/etc/ssh:ro") + fi COMPOSE_DOCKER_IMAGE=${COMPOSE_DOCKER_IMAGE:-docker.0k.io/compose} docker_run_opts+=("-e" "COMPOSE_DOCKER_IMAGE=$COMPOSE_DOCKER_IMAGE") @@ -838,11 +844,6 @@ mk_docker_run_options() { fi - ## SSH config - # docker_run_opts+=( - # "-v" "$HOME/.ssh:/root/.ssh:ro" - # "-v" "/etc/ssh:/etc/ssh:ro" - # ) COMPOSE_LAUNCHER_BIN=$(readlink -f "${BASH_SOURCE[0]}") docker_run_opts+=("-v" "$COMPOSE_LAUNCHER_BIN:/usr/local/bin/compose")