engine: simplify apt-based installation for ubuntu

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2023-09-04 17:33:45 +02:00
parent 7b7ec5b1e8
commit bf9b3dd01c
3 changed files with 39 additions and 55 deletions

View File

@ -29,7 +29,7 @@ For Compose standalone, see [Install Compose Standalone](standalone.md).
1. Set up the repository. Find distro-specific instructions in:
[Ubuntu](../../engine/install/ubuntu.md/#set-up-the-repository) |
[Ubuntu](../../engine/install/ubuntu.md/#install-using-the-repository) |
[CentOS](../../engine/install/centos.md/#set-up-the-repository) |
[Debian](../../engine/install/debian.md/#install-using-the-repository) |
[Raspberry Pi OS](../../engine/install/raspberry-pi-os.md/#install-using-the-repository) |
@ -116,4 +116,4 @@ To update the Compose plugin, run the following commands:
```console
$ docker compose version
Docker Compose version {{% param "compose_version" %}}
```
```

View File

@ -50,7 +50,8 @@ To install Docker Desktop successfully, you must:
Recommended approach to install Docker Desktop on Ubuntu:
1. Set up [Docker's package repository](../../engine/install/ubuntu.md#set-up-the-repository).
1. Set up Docker's package repository.
See [Install using the Apt repository, step 1](../../engine/install/ubuntu.md#install-using-the-repository).
2. Download latest [DEB package](https://desktop.docker.com/linux/main/amd64/docker-desktop-4.22.1-amd64.deb?utm_source=docker&utm_medium=webreferral&utm_campaign=docs-driven-download-linux-amd64).
@ -96,4 +97,4 @@ $ sudo apt-get install ./docker-desktop-<version>-<arch>.deb
- Take a look at the [Get started](../../get-started/index.md) training modules to learn how to build an image and run it as a containerized application.
- [Explore Docker Desktop](../use-desktop/index.md) and all its features.
- Review the topics in [Develop with Docker](../../develop/index.md) to learn how to build new applications using Docker.
- Review the topics in [Develop with Docker](../../develop/index.md) to learn how to build new applications using Docker.

View File

@ -89,64 +89,46 @@ You can install Docker Engine in different ways, depending on your needs:
the easiest and quickest way to get started.
- Set up and install Docker Engine from
[Docker's `apt` repository](#install-using-the-repository).
[Docker's Apt repository](#install-using-the-repository).
- [Install it manually](#install-from-a-package) and manage upgrades manually.
- Use a [convenience script](#install-using-the-convenience-script). Only
recommended for testing and development environments.
### Install using the apt repository {#install-using-the-repository}
### Install using the Apt repository {#install-using-the-repository}
Before you install Docker Engine for the first time on a new host machine, you
need to set up the Docker repository. Afterward, you can install and update
Docker from the repository.
#### Set up the repository
1. Set up Docker's Apt repository.
```bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL {{% param "download-url-base" %}}/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
1. Update the `apt` package index and install packages to allow `apt` to use a
repository over HTTPS:
```console
$ sudo apt-get update
$ sudo apt-get install ca-certificates curl gnupg
```
2. Add Docker's official GPG key:
```console
$ sudo install -m 0755 -d /etc/apt/keyrings
$ curl -fsSL {{% param "download-url-base" %}}/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
$ sudo chmod a+r /etc/apt/keyrings/docker.gpg
```
3. Use the following command to set up the repository:
```console
$ echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] {{% param "download-url-base" %}} \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
> **Note**
>
> If you use an Ubuntu derivative distro, such as Linux Mint,
> you may need to use `UBUNTU_CODENAME` instead of `VERSION_CODENAME`.
4. Update the `apt` package index:
```console
$ sudo apt-get update
# Add the repository to Apt sources:
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] {{% param "download-url-base" %}} \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
```
#### Install Docker Engine
> **Note**
>
> If you use an Ubuntu derivative distro, such as Linux Mint,
> you may need to use `UBUNTU_CODENAME` instead of `VERSION_CODENAME`.
1. Install Docker Engine, containerd, and Docker Compose.
2. Install the Docker packages.
{{< tabs >}}
{{< tab name="Latest" >}}
{{< tabs >}}
{{< tab name="Latest" >}}
To install the latest version, run:
@ -154,11 +136,11 @@ Docker from the repository.
$ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```
{{< /tab >}}
{{< tab name="Specific version" >}}
{{< /tab >}}
{{< tab name="Specific version" >}}
To install a specific version of Docker Engine, start by listing the available
versions in the repository:
To install a specific version of Docker Engine, start by listing the
available versions in the repository:
```console
# List the available versions:
@ -166,7 +148,7 @@ Docker from the repository.
5:24.0.0-1~ubuntu.22.04~jammy
5:23.0.6-1~ubuntu.22.04~jammy
<...>
...
```
Select the desired version and install:
@ -176,10 +158,10 @@ Docker from the repository.
$ sudo apt-get install docker-ce=$VERSION_STRING docker-ce-cli=$VERSION_STRING containerd.io docker-buildx-plugin docker-compose-plugin
```
{{< /tab >}}
{{< /tabs >}}
{{< /tab >}}
{{< /tabs >}}
2. Verify that the Docker Engine installation is successful by running the
3. Verify that the Docker Engine installation is successful by running the
`hello-world` image.
```console
@ -195,7 +177,8 @@ You have now successfully installed and started Docker Engine.
#### Upgrade Docker Engine
To upgrade Docker Engine, follow the [installation instructions](#install-using-the-repository),
To upgrade Docker Engine, follow step 2 of the
[installation instructions](#install-using-the-repository),
choosing the new version you want to install.
### Install from a package
@ -277,4 +260,4 @@ You have to delete any edited configuration files manually.
- Continue to [Post-installation steps for Linux](linux-postinstall.md).
- Review the topics in [Develop with Docker](../../develop/index.md) to learn
how to build new applications using Docker.
how to build new applications using Docker.