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

Merge pull request #44213 from thaJeztah/more_robust_rootless

contrib: make dockerd-rootless-setuptool.sh more robust
This commit is contained in:
Sebastiaan van Stijn 2022-09-29 10:31:53 +02:00 committed by GitHub
commit 572ca799db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -354,24 +354,24 @@ install_nonsystemd() {
cli_ctx_exists() {
name="$1"
"${BIN}/docker" context inspect -f "{{.Name}}" "${name}" > /dev/null 2>&1
"${BIN}/docker" --context=default context inspect -f "{{.Name}}" "${name}" > /dev/null 2>&1
}
cli_ctx_create() {
name="$1"
host="$2"
description="$3"
"${BIN}/docker" context create "${name}" --docker "host=${host}" --description "${description}" > /dev/null
"${BIN}/docker" --context=default context create "${name}" --docker "host=${host}" --description "${description}" > /dev/null
}
cli_ctx_use() {
name="$1"
"${BIN}/docker" context use "${name}" > /dev/null
"${BIN}/docker" --context=default context use "${name}" > /dev/null
}
cli_ctx_rm() {
name="$1"
"${BIN}/docker" context rm -f "${name}" > /dev/null
"${BIN}/docker" --context=default context rm -f "${name}" > /dev/null
}
# CLI subcommand: "install"
@ -430,7 +430,12 @@ cmd_entrypoint_uninstall() {
cli_ctx_rm "${CLI_CONTEXT}"
INFO "Deleted CLI context \"${CLI_CONTEXT}\""
fi
unset DOCKER_HOST
unset DOCKER_CONTEXT
cli_ctx_use "default"
INFO 'Configured CLI use the "default" context.'
INFO
INFO 'Make sure to unset or update the environment PATH, DOCKER_HOST, and DOCKER_CONTEXT environment variables if you have added them to `~/.bashrc`.'
INFO "This uninstallation tool does NOT remove Docker binaries and data."
INFO "To remove data, run: \`$BIN/rootlesskit rm -rf $HOME/.local/share/docker\`"
}