`/tmp/docker-$(id -u)` is not a good candidate as `$XDG_RUNTIME_DIR`,
because it might be already created by another user.
The new path is `$HOME/.docker/run`.
Cherry-picked from https://github.com/docker/docker-install/pull/178
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
| ... | ... |
@@ -95,8 +95,8 @@ init() {
|
| 95 | 95 |
ERROR "- or simply log back in as the desired unprivileged user (ssh works for remote machines, machinectl shell works for local machines)" |
| 96 | 96 |
exit 1 |
| 97 | 97 |
fi |
| 98 |
- export XDG_RUNTIME_DIR="/tmp/docker-$(id -u)" |
|
| 99 |
- mkdir -p "$XDG_RUNTIME_DIR" |
|
| 98 |
+ export XDG_RUNTIME_DIR="$HOME/.docker/run" |
|
| 99 |
+ mkdir -p -m 700 "$XDG_RUNTIME_DIR" |
|
| 100 | 100 |
XDG_RUNTIME_DIR_CREATED=1 |
| 101 | 101 |
fi |
| 102 | 102 |
|
| ... | ... |
@@ -343,6 +343,7 @@ cmd_entrypoint_install() {
|
| 343 | 343 |
INFO "Make sure the following environment variables are set (or add them to ~/.bashrc):" |
| 344 | 344 |
echo |
| 345 | 345 |
if [ -n "$XDG_RUNTIME_DIR_CREATED" ]; then |
| 346 |
+ echo "# WARNING: systemd not found. You have to remove XDG_RUNTIME_DIR manually on every logout." |
|
| 346 | 347 |
echo "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}"
|
| 347 | 348 |
fi |
| 348 | 349 |
echo "export PATH=${BIN}:\$PATH"
|