mirror of
https://github.com/docker/docker-install.git
synced 2026-11-20 10:03:11 +03:00
Merge pull request #202 from AkihiroSuda/rootless-cleanup
rootless-install.sh: remove v19.03 functions
This commit is contained in:
1 file changed
+2
-149
+2
-149
@@ -62,11 +62,6 @@ init_vars() {
|
||||
if systemctl --user daemon-reload >/dev/null 2>&1; then
|
||||
SYSTEMD=1
|
||||
fi
|
||||
|
||||
V1903=
|
||||
if [ "$CHANNEL" = "stable" ] && ( echo "$STABLE_LATEST" | grep -q "^19\.03" ); then
|
||||
V1903=1
|
||||
fi
|
||||
}
|
||||
|
||||
checks() {
|
||||
@@ -113,22 +108,13 @@ checks() {
|
||||
>&2 echo "- or simply log back in as the desired unprivileged user (ssh works for remote machines)"
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$V1903" ]; then
|
||||
export XDG_RUNTIME_DIR="$HOME/.docker/run"
|
||||
mkdir -p -m 700 "$XDG_RUNTIME_DIR"
|
||||
XDG_RUNTIME_DIR_CREATED=1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Already installed verification (unless force?). Only having docker cli binary previously shouldn't fail the build.
|
||||
if [ -x "$BIN/$DAEMON" ]; then
|
||||
# If rootless installation is detected print out the modified PATH and DOCKER_HOST that needs to be set.
|
||||
echo "# Existing rootless Docker detected at $BIN/$DAEMON"
|
||||
if [ -n "$V1903" ]; then
|
||||
v1903_print_instructions
|
||||
else
|
||||
echo "# See https://docs.docker.com/engine/security/rootless/ for the usage."
|
||||
fi
|
||||
echo "# See https://docs.docker.com/engine/security/rootless/ for the usage."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -219,135 +205,6 @@ echo \"$(id -un):100000:65536\" >> /etc/subgid"
|
||||
fi
|
||||
}
|
||||
|
||||
v1903_start_docker() {
|
||||
# detect if overlay is supported (ubuntu)
|
||||
tmpdir=$(mktemp -d)
|
||||
mkdir -p $tmpdir/lower $tmpdir/upper $tmpdir/work $tmpdir/merged
|
||||
if "$BIN"/rootlesskit mount -t overlay overlay -olowerdir=$tmpdir/lower,upperdir=$tmpdir/upper,workdir=$tmpdir/work $tmpdir/merged >/dev/null 2>&1; then
|
||||
USE_OVERLAY=1
|
||||
fi
|
||||
rm -rf "$tmpdir"
|
||||
|
||||
if [ -z "$SYSTEMD" ]; then
|
||||
v1903_start_docker_nonsystemd
|
||||
return
|
||||
fi
|
||||
|
||||
mkdir -p $HOME/.config/systemd/user
|
||||
|
||||
DOCKERD_FLAGS="--experimental"
|
||||
|
||||
if [ -n "$SKIP_IPTABLES" ]; then
|
||||
DOCKERD_FLAGS="$DOCKERD_FLAGS --iptables=false"
|
||||
fi
|
||||
|
||||
if [ "$USE_OVERLAY" = "1" ]; then
|
||||
DOCKERD_FLAGS="$DOCKERD_FLAGS --storage-driver=overlay2"
|
||||
else
|
||||
DOCKERD_FLAGS="$DOCKERD_FLAGS --storage-driver=vfs"
|
||||
fi
|
||||
|
||||
CFG_DIR="$HOME/.config"
|
||||
if [ -n "$XDG_CONFIG_HOME" ]; then
|
||||
CFG_DIR="$XDG_CONFIG_HOME"
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f $CFG_DIR/systemd/user/docker.service ]; then
|
||||
cat <<EOT > $CFG_DIR/systemd/user/docker.service
|
||||
[Unit]
|
||||
Description=Docker Application Container Engine (Rootless)
|
||||
Documentation=https://docs.docker.com
|
||||
|
||||
[Service]
|
||||
Environment=PATH=$BIN:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
ExecStart=$BIN/dockerd-rootless.sh $DOCKERD_FLAGS
|
||||
ExecReload=/bin/kill -s HUP \$MAINPID
|
||||
TimeoutSec=0
|
||||
RestartSec=2
|
||||
Restart=always
|
||||
StartLimitBurst=3
|
||||
StartLimitInterval=60s
|
||||
LimitNOFILE=infinity
|
||||
LimitNPROC=infinity
|
||||
LimitCORE=infinity
|
||||
TasksMax=infinity
|
||||
Delegate=yes
|
||||
Type=simple
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
EOT
|
||||
systemctl --user daemon-reload
|
||||
fi
|
||||
if ! systemctl --user status docker >/dev/null 2>&1; then
|
||||
echo "# starting systemd service"
|
||||
systemctl --user start docker
|
||||
fi
|
||||
systemctl --user status docker | cat
|
||||
|
||||
sleep 1
|
||||
PATH="$BIN:$PATH" DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock" docker version
|
||||
}
|
||||
|
||||
v1903_service_instructions() {
|
||||
if [ -z "$SYSTEMD" ]; then
|
||||
return
|
||||
fi
|
||||
cat <<EOT
|
||||
#
|
||||
# To control docker service run:
|
||||
# systemctl --user (start|stop|restart) docker
|
||||
#
|
||||
EOT
|
||||
}
|
||||
|
||||
|
||||
v1903_start_docker_nonsystemd() {
|
||||
iptablesflag=
|
||||
if [ -n "$SKIP_IPTABLES" ]; then
|
||||
iptablesflag="--iptables=false "
|
||||
fi
|
||||
cat <<EOT
|
||||
# systemd not detected, dockerd daemon needs to be started manually
|
||||
|
||||
$BIN/dockerd-rootless.sh --experimental $iptablesflag--storage-driver vfs
|
||||
|
||||
EOT
|
||||
}
|
||||
|
||||
v1903_print_instructions() {
|
||||
v1903_start_docker
|
||||
echo "# Docker binaries are installed in $BIN"
|
||||
if [ "$(which $DAEMON)" != "$BIN/$DAEMON" ]; then
|
||||
echo "# WARN: dockerd is not in your current PATH or pointing to $BIN/$DAEMON"
|
||||
fi
|
||||
echo "# Make sure the following environment variables are set (or add them to ~/.bashrc):"
|
||||
|
||||
if [ -n "$XDG_RUNTIME_DIR_CREATED" ]; then
|
||||
echo "# WARN: systemd not found. You have to remove XDG_RUNTIME_DIR manually on every logout."
|
||||
echo "export XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR"
|
||||
fi
|
||||
|
||||
case :$PATH: in
|
||||
*:$BIN:*) ;;
|
||||
*) echo "export PATH=$BIN:\$PATH" ;;
|
||||
esac
|
||||
|
||||
# iptables is required but /sbin might not be in PATH
|
||||
if [ -z "$SKIP_IPTABLES" ] && ! which iptables >/dev/null 2>&1; then
|
||||
if [ -f /sbin/iptables ]; then
|
||||
echo "export PATH=\$PATH:/sbin"
|
||||
elif [ -f /usr/sbin/iptables ]; then
|
||||
echo "export PATH=\$PATH:/usr/sbin"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock"
|
||||
echo
|
||||
v1903_service_instructions
|
||||
}
|
||||
|
||||
exec_setuptool() {
|
||||
if [ -n "$FORCE_ROOTLESS_INSTALL" ]; then
|
||||
set -- "$@" --force
|
||||
@@ -381,11 +238,7 @@ do_install() {
|
||||
tar zxf "$tmp/rootless.tgz" --strip-components=1
|
||||
)
|
||||
|
||||
if [ -n "$V1903" ]; then
|
||||
v1903_print_instructions
|
||||
else
|
||||
exec_setuptool "$@"
|
||||
fi
|
||||
exec_setuptool "$@"
|
||||
}
|
||||
|
||||
do_install "$@"
|
||||
Reference in new issue
Block a user