To update Docker to the latest version, the exact steps depend on your operating system and how Docker was originally installed.
Here's a breakdown for the most common scenarios:
1. For Docker Desktop (Windows & macOS)
This is the easiest method. Docker Desktop includes a built-in update mechanism.
- Open Docker Desktop: You'll usually find its icon in your system tray (Windows) or menu bar (macOS).
- Check for Updates:
- Windows: Click the Docker whale icon in the system tray -> "Check for Updates" or "Settings" (gear icon) -> "Software Updates".
- macOS: Click the Docker whale icon in the menu bar -> "Check for Updates" or "Settings" (gear icon) -> "Software Updates".
- Install Update: If an update is available, Docker Desktop will prompt you to download and install it. Follow the on-screen instructions. This usually involves restarting Docker Desktop.
If the above doesn't work or you want to force it:
- You can always download the latest Docker Desktop installer directly from the official Docker website: https://www.docker.com/products/docker-desktop/
- Running the new installer will typically upgrade your existing Docker Desktop installation.
2. For Docker Engine (Linux)
Updating Docker Engine on Linux usually involves using your distribution's package manager. These instructions assume you installed Docker using the official Docker repositories (which is the recommended way).
Before you begin (Important for Linux):
- Backup any critical data: Especially Docker volumes if they contain important application data.
- Understand downtime: The Docker daemon will be stopped and restarted during the update, meaning any running containers will be stopped.
- Check for breaking changes: For major version updates, it's a good idea to quickly check Docker's release notes for any breaking changes that might affect your applications.
a. Debian/Ubuntu (using apt)
- Update your package lists:
sudo apt update
- Upgrade Docker packages:
sudo apt upgrade docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Note: If you previously installed
docker.io (the version from Ubuntu's default repos), you might want to remove it first: sudo apt remove docker.io before installing the docker-ce packages from Docker's official repos.
- Restart the Docker service:
sudo systemctl restart docker
b. CentOS/RHEL/Fedora (using yum or dnf)
- Clean Yum/DNF cache (optional but good practice):
sudo yum clean all # or dnf clean all
- Update Docker packages:
sudo yum update docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Or for Fedora/newer RHEL:
# sudo dnf update docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
- Restart the Docker service:
sudo systemctl restart docker
c. Other Linux Distributions / Manual Install
If you installed Docker manually or via a different method, you might need to follow the specific instructions for that method. Generally, if you used a script like get-docker.sh, re-running the latest version of that script might update it, but it's not the recommended long-term update strategy. It's usually better to set up the official Docker repositories.
3. Verify the Update
After running the update command and restarting Docker, verify that you are running the latest version:
-
Check Docker version:
docker --version
This will show the client version.
-
Check Docker daemon version (more detailed):
docker info | grep "Server Version"
This will show the version of the Docker daemon that's running.
-
Run a simple test container:
docker run hello-world
If this runs successfully, your Docker installation is likely working correctly.
Choose the section that applies to your setup, and you should be able to update Docker to the latest version.