Install Docker Engine on Ubuntu (2023)

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 ofContainerorun.Uninstall these older versions before trying to install a new version:

ps sudoapt-get remove docker docker-engine docker.io containerd runc

apt-getit 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

  1. updateappropriateAllow package index and installation packagesappropriateto 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
  2. 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
  3. 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

Install the docker engine

  1. updateappropriatepackage index:

    ps sudoapt-get update

    Getting a GPG error while runningapt-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
  2. Install o Docker Engine, container, and Docker Compose.


    To install the latest version, run:

    (Video) Docker Desktop installation on Ubuntu 22.04

    ps 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
  3. Verify that the Docker Engine installation was successful by running theHello WorldPhoto:

    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. EITHERstevedoreuser group exists but does not contain any users so you need to use itsudoto 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 dockerappropriateRepository to install Docker Engine, you can download thedebtfile for your version and install it manually. You must download a new file each time you want to update Docker Engine.

  1. Gonnahttps://download.docker.com/linux/ubuntu/dists/.

    (Video) How to Install Docker On Ubuntu 20.04 LTS Focal Fossa

  2. Select your version of Ubuntu from the list.

  3. Gonnapool/barn/and select the applicable architecture (amd64,arm,braco64, os390x).

  4. Download the followingdebtFiles 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
  5. install this.debutantepackages 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.

  6. Verify that the Docker Engine installation was successful by running theHello WorldPhoto:

    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. EITHERstevedoreuser group exists but does not contain any users so you need to use itsudoto 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-instalarRepository 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 requiresfuenteosudorun 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 runningOption 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 | Simplilearn

ps shirred ruffle-fsSLhttps://get.docker.comget-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.comget-docker.shps sudosh get-docker.shRun the commit docker installer script: 7cae5f8b0decc17d6571f9f52eb840fbc13b2737<...>

You have now successfully installed and started Docker Engine. EITHERstevedoreThe service starts automatically on Debian-based distributions. In itnumber of revolutionsdistributions based on CentOS, Fedora, RHEL or SLES, you must start them manually with thesystemctloServiceDomain. 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 requiresfuenteosudoPermissions 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 itfuentehave 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.comprueba-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

  1. 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
  2. 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 Ubuntu

    ps 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.

Videos

1. Installing Docker Engine on Ubuntu | Docker شرح
(Codographia)
2. Installing docker on Ubuntu | Install docker-ce on Ubuntu 22.04 LTS!
(In front of IT)
3. Installing Docker on Ubuntu
(James Stormes)
4. How to Install Docker on Ubuntu 22.04 | Docker on Ubuntu 22.04 LTS | Installing Docker on Ubuntu
(TechSolutionZ)
5. How To Install and Use Docker Engine on Ubuntu 20.04 (Tutorial)
(Cloud Infrastructure Services)
6. How to Install Docker on Ubuntu 22.10 Docker Engine on Ubuntu 22.10 Kinetic Kodu
(TechSolutionZ)
Top Articles
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated: 06/05/2023

Views: 5709

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.