How can I safely update Docker without losing my containers?

0
23
Asked By CleverPanda42 On

I installed Docker using the command `sudo apt-get install docker.io docker-compose -y` earlier this year on Debian, probably following a YouTube tutorial. I've realized that I'm on an older version, specifically Docker 20.10.24 and Docker Compose 1.29.2. Now, I have several services running in Docker, and I want to know how I can update to the latest version without losing any of my running services or containers. Any advice on the best approach?

4 Answers

Answered By PracticalPenguin11 On

Just to clarify, the method you used isn't actually an 'outdated' method; it's just the standard way for your Linux distribution to install Docker.

Answered By LevelheadedLion89 On

Check out the official Docker docs on uninstalling old versions [here](https://docs.docker.com/engine/install/debian/#uninstall-old-versions). If you're following good practices and all your containers are defined with compose files and stored in volumes on the host, you can uninstall the current Docker and Docker Compose and then install them fresh, the right way. Just remember to back up anything important first!

SafetyFirst88 -

Great advice! I'm planning to do a full disk image backup before starting the update. Better safe than sorry!

Answered By CuriousCat123 On

You can run `curl -fsSL https://get.docker.com | bash` to update Docker. Just be aware that there's a risk involved with running scripts you find online. If you want to be extra cautious, download the script, review it first, and then execute it after you're sure it's safe!

ThoughtfulSquirrel76 -

Running scripts from the internet can be risky. That script is pretty long, almost 700 lines! You'd need to verify all of it for safety. Another option is to add Docker's official APT repository and use `apt-get` to install updates, which provides some extra security.

Answered By FriendlyOcelot22 On

Here's a quick snapshot of your current version, if you're curious about it!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.