Unattended-upgrades Rootless Docker?

Hi,

By installing Rootful Docker on a Raspberry Pi, I can update Docker with a sudo apt update && sudo apt upgrade on the host could upgrade the Docker installation. I can also configure unattended-upgrades to update Docker automatically.

However, Rootless Docker doesn’t update with sudo apt update && sudo apt upgrade on the host. So is there a way to upgrade Rootless Docker, apart from checking on the official website and downloading it if there is a new version ?
If yes, is it possible via unattended-upgrades ?

I am not trying to update the containers, but Docker itself.

The Pi is on Debian Buster, if it matters.

Thanks in advance for any help you can provide :slight_smile:

1 Like

thanx broo share the great info with us

I also found no official way to update a docker-rootless installation.
So here is how i update docker-rootless. its a bit experimental, but it works for me. maybe it needs some more tests to make it more robust and ready to be usable in a script or 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 rootless.sh executable
chmod +x rootless.sh

# run rootles.sh
./rootless.sh

# kill installation script, because it starts docker.service and keeps running
CTRL+C

# finaly 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.5, build 363e9a8


# 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.0, build 07737305


# maybe you should reboot your host once!
sudo reboot