How to install Docker CE on Ubuntu 22.04 LTS Jammy Jellyfish

Docker is an open-source project that gives us the ability to easily run applications in isolated containers. Those who are using Ubuntu 22.04 LTS  and want to install Docker CE to run containers of various Linux apps can follow this tutorial.

Another benefit of Docker containers is they can build on one another and communicate with one another. Examples of these applications would be an Apache server or a MySQL database.

Compared to normal virtual machines we do not need every container to run a complete operating system. I mean if we want to run a separate web server from the database server, we would have to start two complete virtual machines including the operating system. This is not the case with Docker, in it, the underlying kernel will be the same and two independent containers can be started for respective servers without installing the full-blown operating system instead a lightweight Docker image will do the work.

Furthermore, Docker is a cross-platform project hence regardless of the OS (Windows, Linux, or macOS) it runs the command that will be the same for all and there will not be any compatibility issues between the containers.

Steps to install Docker CE on Ubuntu 22.04 LTS Jammy Jellyfish

1. System update and install a few tools

sudo apt update
sudo apt install ca-certificates curl apt-transport-https

2. Add GPG Key

To download the packages of Docker on Ubuntu, we need to add the GPG key used to sign the Docker packages by its developer otherwise the system will return an error and not be able to use the repository.

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

3. Add docker repository on Ubuntu 22.04

We can install the docker using Ubuntu Jammy’s default system repository, however, the version available will not be the latest one. Hence, add the official repository of Docker manually using the given block of command below.

Copy-paste the whole block of command in your terminal:

echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] \
  "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

4. Install Docker Engine on Ubuntu 22.04

Finally, we have configured all the required things we needed. Now, simply run the system update command to refresh the repository cache and update already installed packages. After that use the APT packages to get all the Docker tools we need to start creating containers.

sudo apt update
sudo apt-get install docker-ce docker-ce-cli docker-compose
Install Docker Engine Ubuntu 22.04 Jammy

To check the Docker service is running:

systemctl status docker

In case, it is not running, then use:

sudo systemctl start docker
sudo systemctl enable docker

5. Use docker without sudo

Once the installation is completed, we need to add our current system user to the Docker group otherwise every time we need to use the’sudo‘ with every command of the Docker.

sudo usermod -aG docker $USER
newgrp docker

To check the version:

docker version
Run docker command without sudo

6. Create a Container

Now, we can start creating our first container. For example, let’s say you want to create a Debian Bullseye container. For that, we will pull its docker image.

docker pull debian

Create container:

docker create -it --name test debian

Start container

docker start test

Get the command line of the installed container:

docker attach test
create docker container on Ubuntu 22.04 LTS

Other Articles:

How to install Ubuntu 22.04 LTS container on Docker.
Download and install Ubuntu 22.04 LTS ISO on VirtualBox 

2 thoughts on “How to install Docker CE on Ubuntu 22.04 LTS Jammy Jellyfish”

  1. Fails on install/service run of docker-ce?

    Using armbian jammy…

    # cat /etc/os-release
    PRETTY_NAME=”Armbian 23.05.0-trunk jammy”
    VERSION=”22.04.2 LTS (Jammy Jellyfish)”

    Job for docker.service failed because the control process exited with error code.
    See “systemctl status docker.service” and “journalctl -xeu docker.service” for details.
    invoke-rc.d: initscript docker, action “start” failed.
    ● docker.service – Docker Application Container Engine
    Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
    Active: activating (auto-restart) (Result: exit-code) since Fri 2023-06-16 16:59:57 PDT; 34ms ago
    TriggeredBy: ● docker.socket
    Process: 44142 ExecStart=/usr/bin/dockerd -H fd:// –containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
    Main PID: 44142 (code=exited, status=1/FAILURE)
    CPU: 233ms

    Jun 16 16:59:57 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
    Jun 16 16:59:57 systemd[1]: docker.service: Failed with result ‘exit-code’.
    Jun 16 16:59:57 systemd[1]: Failed to start Docker Application Container Engine.
    dpkg: error processing package docker-ce (–configure):

  2. The issue is based on incompatibility with iptables 1.8.7 or use of NFT rules, such as Ubuntu 22.04 or Debian 12 respectively. The docker-ce package fails to establish the correct rules in either case. The work-around, it is ONLY a work-around is to enable iptables legacy support on the Linux OS in use. Then, docker-ce configuration can be re-done, installation completes and docker-ce service executes without failure.

    # update-alternatives –set iptables /usr/sbin/iptables-legacy
    # update-alternatives –set ip6tables /usr/sbin/ip6tables-legacy

    This is only a work-around, the docker-ce package MUST be revised to use newer iptables 1.8.7 or comply with the newer NFT rule sets.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.