Docker Community Forums

Share and learn in the Docker community.

Unattended-upgrades Rootless Docker?


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

# 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 -O

# set environment variables (used by script)

# remove "Already installed verification" check from script
sed -i s#\-x\ \"\$BIN/\$DAEMON\"#\!\ \-x\ \"\$BIN/\$DAEMON\"#g

# make executable
chmod +x

# run

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

# 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 "" | grep -o -P '(?<=*(?=/docker-compose)' | head -n1)

# download docker-compose
sudo curl -L "$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