From 7c17ad873596de0c9fe7e09f28d229b482386f13 Mon Sep 17 00:00:00 2001 From: Mathieu PATUREL Date: Fri, 10 Dec 2021 15:30:52 +1100 Subject: [PATCH] docker-rootless-setuptools.sh: use context after install Signed-off-by: Mathieu PATUREL --- contrib/dockerd-rootless-setuptool.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/contrib/dockerd-rootless-setuptool.sh b/contrib/dockerd-rootless-setuptool.sh index 6324a59507..7dc7c90c29 100755 --- a/contrib/dockerd-rootless-setuptool.sh +++ b/contrib/dockerd-rootless-setuptool.sh @@ -364,6 +364,11 @@ cli_ctx_create() { "${BIN}/docker" context create "${name}" --docker "host=${host}" --description "${description}" > /dev/null } +cli_ctx_use() { + name="$1" + "${BIN}/docker" context use "${name}" > /dev/null +} + cli_ctx_rm() { name="$1" "${BIN}/docker" context rm -f "${name}" > /dev/null @@ -385,6 +390,9 @@ cmd_entrypoint_install() { cli_ctx_create "${CLI_CONTEXT}" "unix://${XDG_RUNTIME_DIR}/docker.sock" "Rootless mode" fi + INFO "Use CLI context \"${CLI_CONTEXT}\"" + cli_ctx_use "${CLI_CONTEXT}" + echo INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):" echo @@ -393,6 +401,7 @@ cmd_entrypoint_install() { echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" fi echo "export PATH=${BIN}:\$PATH" + echo "Some applications may require the following environment variable too:" echo "export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/docker.sock" echo