I installed Docker at the beginning of the year using the command `sudo apt get install docker.io docker-compose -y` on my Debian system, likely following a YouTube guide, and now I realize I'm running an outdated version (Docker 20.10.24 and Docker Compose 1.29.2). I have several services actively running in Docker, and I want to update it to the latest version without losing any of my current containers or services. What's the best approach for doing this safely?
4 Answers
Here’s a screenshot of what version I’m currently running if that helps.
Just to clarify, using `apt get install` isn’t an outdated method; it’s simply how your Linux distribution supports Docker. It’s a valid way to go about it!
You might want to try running this command: `curl -fsSL https://get.docker.com | bash`, but just a heads up—there are risks involved with executing scripts from the internet. If you want to be extra careful, save the script first and review it before running it.
You can check out the Docker documentation for uninstalling old versions [here](https://docs.docker.com/engine/install/debian/#uninstall-old-versions). If you've managed your containers properly—like using compose files and having your important data in volumes on the host—you should be able to uninstall the old Docker and Docker Compose and install the new versions without much trouble. Just remember to backup any important stuff first!
Thanks for the suggestion! I’m definitely planning on doing a full disk image backup before attempting any updates. Better safe than sorry!

Yeah, running random scripts is definitely a gamble. That script is pretty long—700 lines! Are you really going to check every single line to make sure it’s safe? A better alternative is to add Docker’s official apt repository and install Docker through `apt-get`. It includes an added layer of security with cryptographic signing.