我还没有找到更新 docker-rootless 安装的官方方法。
所以这就是我更新 docker-rootless 的方法。它有点实验性,但它对我有用。也许它需要更多测试以使其更健壮并准备好在脚本或 crontab 中使用:
# UPDATE DOCKER-ROOTLESS (as user which docker-rootless runs with):
# stop your docker daemon ... (takes long time for me and doesn't finish problerly)
systemctl --user stop docker.service
# maybe you have to kill it because it hangs up and doesn't finish proberly
CTRL+C
# check that docker.service isn't running (important !!!)
systemctl --user status docker.service
# Active: inactive (dead)
# OR:
# Active: failed (Result: exit-code)
# download docker-rootless installation script
wget https://get.docker.com/rootless -O rootless.sh
# set environment variables (used by rootless.sh script)
SKIP_IPTABLES=1
FORCE_ROOTLESS_INSTALL=1
# remove "Already installed verification" check from script
sed -i s#\-x\ \"\$BIN/\$DAEMON\"#\!\ \-x\ \"\$BIN/\$DAEMON\"#g rootless.sh
# make rootles.sh executable
chmod +x rootless.sh
# run rootless.sh
./rootless.sh
# kill installation script, because it starts docker.service and keeps running
CTRL+C
# finally setcap cap_net_bind_service (to bind ports less than 1024)
# replace 'docker' with the username you are logged in with
sudo setcap cap_net_bind_service=ep /home/docker/bin/rootlesskit
# DONE (docker should now be updated)
docker --version
# Docker version 20.10.6, build 370c289
# UPDATE DOCKER-COMPOSE (with sudo or root):
# get and save latest docker-compose version
DOCKER_COMPOSE_VERSION=$(curl -L "https://docs.docker.com/compose/install/" | grep -o -P '(?<=https://github.com/docker/compose/releases/download/).*(?=/docker-compose)' | head -n1)
# download docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# make it executable
sudo chmod +x /usr/local/bin/docker-compose
# link it to /usr/bin
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# DONE (docker-compose should now be updated)
docker-compose --version
# docker-compose version 1.29.1, build c34c88b2
# remove docker-rootless script
rm rootless.sh
# maybe you should reboot your host once!
sudo reboot