1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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

Signed-off-by: Mathieu PATUREL <mathieu.paturel@gmail.com>
This commit is contained in:
Mathieu PATUREL 2021-12-10 15:30:52 +11:00
parent f6848ae321
commit 7c17ad8735

View file

@ -364,6 +364,11 @@ cli_ctx_create() {
"${BIN}/docker" context create "${name}" --docker "host=${host}" --description "${description}" > /dev/null "${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() { cli_ctx_rm() {
name="$1" name="$1"
"${BIN}/docker" context rm -f "${name}" > /dev/null "${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" cli_ctx_create "${CLI_CONTEXT}" "unix://${XDG_RUNTIME_DIR}/docker.sock" "Rootless mode"
fi fi
INFO "Use CLI context \"${CLI_CONTEXT}\""
cli_ctx_use "${CLI_CONTEXT}"
echo echo
INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):" INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):"
echo echo
@ -393,6 +401,7 @@ cmd_entrypoint_install() {
echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}"
fi fi
echo "export PATH=${BIN}:\$PATH" 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 "export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/docker.sock"
echo echo