To get started with Docker Engine on Ubuntu, make sure youmeet the requirements, and then follow theinstallation steps.
requirements
operating system requirements
To install Docker Engine, you need a 64-bit version of one of these Ubuntu versions:
- Free kinetics 22.10
- Ubuntu Jammy 22.04 (LTS)
- Ubuntu Focus 20.04 (LTS)
- Ubuntu Bionic 18.04 (LTS)
Docker Engine supports x86_64 (or amd64), armhf, arm64, and s390x architectures.
uninstall old versions
Previous versions of Docker were calledstevedore
,docker.io
, oDocker-Engine
, you can also have installations ofContainer
orun
.Uninstall these older versions before trying to install a new version:
ps sudoapt-get remove docker docker-engine docker.io containerd runc
apt-get
it can report that you don't have any of these packages installed.
Images, containers, volumes, and networks stored on/var/lib/docker/
they are not automatically removed when you uninstall Docker. If you want to start with a clean installation and prefer to erase your existing data, read theUninstall Docker EngineSection.
installation methods
You can install Docker Engine in different ways depending on your needs:
-
Docker engine is includedDocker Desktop para Linux. This is the easiest and fastest way to get started.
-
Configure and install Docker Engine fromDocker-friendly repository.
-
install it manuallyand manage updates manually.
-
use acomfort dashes. Recommended for test and development environments only.
Install using apt repository
Before you install Docker Engine on a new host machine for the first time, you must set up the Docker repository. You can then install and update Docker from the repository.
Configure the repository
-
update
appropriate
Allow package index and installation packagesappropriate
to use a repository over HTTPS:ps sudoapt-get updateps sudoapt-getinstall \CA certificates\shirred ruffle\group
(Video) How to Install Docker Engine on Ubuntu 20.04 LTS / Ubuntu 21.10/19.10/18.04 LTS | in 6 minutes -
Add the official Docker GPG key:
ps sudo mkdir -METRO0755-PAGE/etc/apt/keychainsps shirred ruffle-fsSLhttps://download.docker.com/linux/ubuntu/gpg |sudogpg-Liber -Ö/etc/apt/keyrings/docker.gpg
-
Use the following command to configure the repository:
ps ecological \ "deb [arc="psdpkg--print architecture)"signed by =/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu\"ps./etc/os-release&& ecological "$VERSION_CODENAME")"stable"|\ sweat shirt/etc/apt/sources.list.d/docker.list>/dev/null
See Alsoapt-key is obsolete. How to add OpenPGP repository signing keys without them on Debian, Ubuntu, Linux Mint, Pop!_OS, etc.Handling apt-key and add-apt-repository rejection using gpg to add external repositories in Ubuntu 22.04 | digital oceanTake your development to the next level with DevPod - open source tool - Civo.comSet up static code analysis with SonarQube
Install the docker engine
-
update
appropriate
package index:ps sudoapt-get update
Getting a GPG error while running
apt-get update
?your standardface maskit may be misconfigured, preventing detection of the repository's public key file. Try giving read permission to the Dockerpublic key file before updating the package index:
ps sudo chmoda+r /etc/apt/keyrings/docker.gpgps sudoapt-get update
-
Install o Docker Engine, container, and Docker Compose.
To install the latest version, run:
(Video) Docker Desktop installation on Ubuntu 22.04ps sudoapt-getinstalldocker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
To install a specific version of Docker Engine, first list the versions available in the repository:
# List of available versions:ps apt-cache madison docker-ce |ach '{ print $3 }'5:20.10.16~3-0~ubuntu-jammy5:20.10.15~3-0~ubuntu-jammy5:20.10.14~3-0~ubuntu-jammy5:20.10.13~3-0~ubuntu-jammy
Select the desired version and install it:
ps VERSION_STRING=5:20.10.13~3-0~ubuntu-jammyps sudoapt-getinstalldocker-ce=$VERSION_STRINGdocker-ce-cli=$VERSION_STRINGcontainerd.io docker-buildx-plugin docker-compose-plugin
-
Verify that the Docker Engine installation was successful by running the
Hello World
Photo:See AlsoHow to install Elasticsearch, Fluentd and Kibana (EFK) logging stack on Ubuntu 22.04greenbone vulnerability manager installerInfrastructure as Code - Lab 2 - Installing a Microservice Application with Terraform (Exoscale Edition)ps sudodocker start hello world
This command downloads a test image and runs it in a container. If the container is running, it will print a confirmation message and exit.
You have now successfully installed and started Docker Engine. EITHERstevedore
user group exists but does not contain any users so you need to use itsudo
to run docker commands. AdvanceLinux Nach Installationto allow non-privileged users to run Docker commands and for other optional configuration steps.
Update the docker engine
To upgrade Docker Engine, follow theinstallation guideselecting the new version you want to install.
Install from a package
If you can't use dockerappropriate
Repository to install Docker Engine, you can download thedebt
file for your version and install it manually. You must download a new file each time you want to update Docker Engine.
-
Gonnahttps://download.docker.com/linux/ubuntu/dists/.
(Video) How to Install Docker On Ubuntu 20.04 LTS Focal Fossa -
Select your version of Ubuntu from the list.
-
Gonna
pool/barn/
and select the applicable architecture (amd64
,arm
,braco64
, os390x
). -
Download the following
debt
Files for the Docker Engine, CLI, containerd and Docker Compose packages:containerd.io_<version>_<file>.deb
docker-ce_<version>_<file>.deb
docker-ce-cli_<version>_<architecture>.deb
docker-buildx-plugin_<version>_<architecture>.deb
docker-compose-plugin_<version>_<file>.deb
-
install this
.debutante
packages Update the paths in the following example to where you downloaded the packages from Docker.ps sudodpkg-UE./containerd.io_<versión>_<The book>.debutante\./docker-ce_<Version>_<The book>.debutante\./docker-ce-cli_<version>_<The book>.debutante\./docker-buildx-plugin_<version>_<The book>.debutante\./docker-compose-plugin_<version>_<The book>.debutante
The docker daemon starts automatically.
-
Verify that the Docker Engine installation was successful by running the
Hello World
Photo:ps sudoStart Docker Serviceps sudodocker start hello world
This command downloads a test image and runs it in a container. If the container is running, it will print a confirmation message and exit.
You have now successfully installed and started Docker Engine. EITHERstevedore
user group exists but does not contain any users so you need to use itsudo
to run docker commands. ReadLinux Nach Installationto allow non-privileged users to run Docker commands and for other optional configuration steps.
Update the docker engine
To update Docker Engine, download the latest package files and run the Docker Engine again.installation process, points to the new files.
Install using convenience script
Docker provides a useful script athttps://get.docker.com/to install Docker non-interactively in development environments. The convenience script is not recommended for production environments, but it is useful for creating a deployment script tailored to your needs. See also theinstall from repositorySteps to learn the installation steps to install with the package repository. The source code of the script is open source and can be found atdocker-instalar
Repository on GitHub.
Always check scripts downloaded from the web before running them locally. Before installing, familiarize yourself with the potential risks and limitations of the convenience script:
- The script requires
fuente
osudo
run privileges. - The script attempts to detect your Linux distribution and version and configure your package management system for you.
- The script does not allow you to customize most of the installation parameters.
- The script installs dependencies and recommendations without asking for confirmation. This can install a large number of packages depending on the current configuration of your host machine.
- By default, the script installs the latest stable version of docker, containerd, and runc. Using this script to provision a machine can lead to unexpected updates to major Docker versions. Always test updates in a test environment before deploying to your production systems.
- The script is not designed to upgrade an existing Docker installation. If you use the script to update an existing installation, dependencies might not be updated to the expected version, resulting in outdated versions.
Tip: Review the script steps before running them
You can run the script with
--dry running
Option to know what steps the script will perform when it is called:(Video) Docker Installation In Ubuntu | How To Install Docker In Ubuntu? | Docker Installation | Simplilearnps shirred ruffle-fsSLhttps://get.docker.com-Öget-docker.shps sudosh ./get-docker.sh--dry running
In this example, the script is downloaded fromhttps://get.docker.com/and run it to install the latest stable version of Docker on Linux:
ps shirred ruffle-fsSLhttps://get.docker.com-Öget-docker.shps sudosh get-docker.shRun the commit docker installer script: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737<...>
You have now successfully installed and started Docker Engine. EITHERstevedore
The service starts automatically on Debian-based distributions. In itnumber of revolutions
distributions based on CentOS, Fedora, RHEL or SLES, you must start them manually with thesystemctl
oService
Domain. As the message indicates, by default, non-root users cannot run Docker commands.
Use docker as unprivileged user or install it in rootless mode?
The installation script requires
fuente
osudo
Permissions to install and use Docker. If you want to grant access to Docker to non-root users, read thePost-installation steps for Linux.You can also install Docker without itfuente
have privileges or are configured to run in unrooted mode. For instructions on how to run Docker in unrooted mode, seeRun the docker daemon as a non-root user (non-root mode)..
Install preview builds
Docker also provides a useful script athttps://test.docker.com/to install pre-release versions of Docker on Linux. This script is the same as the at scriptget.docker.com
, but configure your package manager to use the test channel of the Docker package repository. The test channel includes stable and preview versions (beta versions, release candidates) of Docker. Use this script to get early access to new versions and test them in a test environment before releasing them as stable again.
To install the latest version of Docker on Linux from the test channel, run:
ps shirred ruffle-fsSLhttps://test.docker.com-Öprueba-docker.shps sudosh test-docker.sh
Upgrade docker after using convenience script
If you installed Docker using the convenience script, update Docker directly with your package manager. There is no benefit to running the useful script again. Recurrences can cause problems when trying to reinstall repositories that already exist on the host machine.
Uninstall Docker Engine
-
Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
ps sudoapt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
-
Custom images, containers, volumes, or configuration files from your host are not automatically removed. To remove all images, containers, and volumes:
(Video) How to install Docker Engine on Ubuntups sudo rm -rf/var/lib/dockerps sudo rm -rf/var/lib/container
You must manually delete all edited configuration files.
Next steps
- advancePost-installation steps for Linux.
- Check the topics inDevelop with Dockerto learn how to build new applications with Docker.