docker-rootless-setuptools.sh: use context after install

Signed-off-by: Mathieu PATUREL <mathieu.paturel@gmail.com>
(cherry picked from commit 7c17ad8735)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Mathieu PATUREL 2021-12-10 15:30:52 +11:00 committed by Sebastiaan van Stijn
parent 4163c55082
commit 53313be0f3
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
1 changed files with 9 additions and 0 deletions

View File

@ -363,6 +363,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
@ -384,6 +389,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
@ -392,6 +400,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