0

在我的 Raspberry Pi 上安装 Rootful Docker 会更新源代码,并且可以unattended-upgrades通过查看sudo apt-cache policy.

但是,Rootless Docker 没有。那么有没有办法升级 Rootless Docker 呢?

换句话说:

使用 Rootful Docker,sudo apt-get update && sudo apt-get -y upgrade可以在主机上升级 Docker 安装。我希望能够用 Rootless Docker 做类似的事情。可能吗 ?

澄清一下:我不是要更新容器,而是要更新 Docker 本身。

提前感谢您提供的任何帮助:)

4

2 回答 2

0

据我所知,Debian 没有特殊的无根包,所以你不能用包管理器来做到这一点。一些无根二进制文件有点不同,缺少 SETUID 位和其他一些文件功能。

但是,您可以尝试再次运行无根安装脚本,如果这会更新您的二进制文件。

curl -fsSL https://get.docker.com/rootless | sh

这些也可以在这里作为rootless-extras获得,但它需要手动提取:

于 2021-02-23T17:05:30.147 回答
0

我还没有找到更新 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
于 2021-04-12T16:25:05.473 回答