Skip to content

Commit 99272ba

Browse files
authored
Merge pull request #23705 from dvdksn/engine-ubuntu-apt
engine: update ubuntu installation instructions to use deb822, apt
2 parents befcaf0 + 556eed6 commit 99272ba

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

content/manuals/engine/install/ubuntu.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ conflicts with the versions bundled with Docker Engine.
8888
Run the following command to uninstall all conflicting packages:
8989

9090
```console
91-
$ for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
91+
$ sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
9292
```
9393

94-
`apt-get` might report that you have none of these packages installed.
94+
`apt` might report that you have none of these packages installed.
9595

9696
Images, containers, volumes, and networks stored in `/var/lib/docker/` aren't
9797
automatically removed when you uninstall Docker. If you want to start with a
@@ -126,18 +126,22 @@ Docker from the repository.
126126

127127
```bash
128128
# Add Docker's official GPG key:
129-
sudo apt-get update
130-
sudo apt-get install ca-certificates curl
129+
sudo apt update
130+
sudo apt install ca-certificates curl
131131
sudo install -m 0755 -d /etc/apt/keyrings
132132
sudo curl -fsSL {{% param "download-url-base" %}}/gpg -o /etc/apt/keyrings/docker.asc
133133
sudo chmod a+r /etc/apt/keyrings/docker.asc
134134

135135
# Add the repository to Apt sources:
136-
echo \
137-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] {{% param "download-url-base" %}} \
138-
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
139-
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
140-
sudo apt-get update
136+
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
137+
Types: deb
138+
URIs: {{% param "download-url-base" %}}
139+
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
140+
Components: stable
141+
Signed-By: /etc/apt/keyrings/docker.asc
142+
EOF
143+
144+
sudo apt update
141145
```
142146
143147
2. Install the Docker packages.
@@ -148,7 +152,7 @@ Docker from the repository.
148152
To install the latest version, run:
149153
150154
```console
151-
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
155+
$ sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
152156
```
153157
154158
{{< /tab >}}
@@ -158,19 +162,18 @@ Docker from the repository.
158162
available versions in the repository:
159163
160164
```console
161-
# List the available versions:
162-
$ apt-cache madison docker-ce | awk '{ print $3 }'
165+
$ apt list --all-versions docker-ce
163166
164-
5:{{% param "docker_ce_version" %}}-1~ubuntu.24.04~noble
165-
5:{{% param "docker_ce_version_prev" %}}-1~ubuntu.24.04~noble
167+
docker-ce/noble 5:{{% param "docker_ce_version" %}}-1~ubuntu.24.04~noble <arch>
168+
docker-ce/noble 5:{{% param "docker_ce_version_prev" %}}-1~ubuntu.24.04~noble <arch>
166169
...
167170
```
168171
169172
Select the desired version and install:
170173
171174
```console
172175
$ VERSION_STRING=5:{{% param "docker_ce_version" %}}-1~ubuntu.24.04~noble
173-
$ sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
176+
$ sudo apt install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
174177
```
175178
176179
{{< /tab >}}
@@ -284,7 +287,7 @@ To upgrade Docker Engine, download the newer package files and repeat the
284287
1. Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
285288
286289
```console
287-
$ sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
290+
$ sudo apt purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
288291
```
289292
290293
2. Images, containers, volumes, or custom configuration files on your host
@@ -298,7 +301,7 @@ To upgrade Docker Engine, download the newer package files and repeat the
298301
3. Remove source list and keyrings
299302
300303
```console
301-
$ sudo rm /etc/apt/sources.list.d/docker.list
304+
$ sudo rm /etc/apt/sources.list.d/docker.sources
302305
$ sudo rm /etc/apt/keyrings/docker.asc
303306
```
304307

0 commit comments

Comments
 (0)