1Byte Cloud & Hosting Ubuntu Install Docker: A Step-by-Step Guide for Beginners

Ubuntu Install Docker: A Step-by-Step Guide for Beginners

Ubuntu Install Docker: A Step-by-Step Guide for Beginners

Docker is a popular container platform. It lets applications run reliably across environments. Many developers use Docker – a 2023 survey finds 63% of developers use Docker. On Ubuntu, Docker enables easy deployment of apps. Ubuntu is a widely used Linux distro. For example, Ubuntu 22.04 LTS (Jammy Jellyfish) accounts for about 46% of Ubuntu installations on one mirror as of May 2025. Ubuntu is the top Linux distro globally, with roughly one-third of the Linux market. This guide for Ubuntu install Docker from 1Byte uses Ubuntu 22.04 LTS as a basis. It walks through installing both Docker Engine and Docker Desktop, and covers post-install steps. It includes data on Docker’s popularity and real examples of using Docker on Ubuntu.

Why Docker on Ubuntu?

Why Docker on Ubuntu?

Docker makes it easy to package and ship apps. It isolates apps in containers, so they run the same on any system. Developers can share containers on Docker Hub. In 2023, Docker ranked as the #1 most-used developer tool in the Stack Overflow survey. Docker usage is widespread even as container runtimes evolve; for example, Datadog reports Docker engine is still used by 65% of container-using organizations (down from 88%). This shows Docker’s core role. Ubuntu supports Docker well. The Ubuntu repositories and Docker’s own docs have clear guides. This guide shows the steps needed to ubuntu install docker on Ubuntu 22.04 LTS (the latest LTS version) and beyond. It covers both the Docker Engine (the CLI and daemon) and Docker Desktop (the GUI edition).

Reliable Cloud Servers, Anytime
1Byte offers high-performance cloud server solutions, ensuring scalability, security, and 24/7 support for your business needs.
FURTHER READING:
1. Node JS Hosting: 7 Best Services for Speed and Scalability in 2025
2. How Much Does a VoIP Phone System Cost in 2025
3. 6 Best Countries for VPN Server Locations 2025

System Requirements

Docker on Ubuntu requires a 64-bit installation. The host must have at least Ubuntu 22.04 LTS or later. Docker Desktop for Linux requires Ubuntu 22.04, 24.04, or a newer non-LTS release. The system should have at least 4 GB RAM and enough disk space. For Docker Engine (CLI/daemon) alone, minimal resources are fine. For Docker Desktop (GUI), a desktop environment is needed. Check that the machine is up-to-date:

  • Ubuntu Version: 22.04 LTS (Jammy Jellyfish) is a common choice. One mirror shows it at ~46% usage.
  • Architecture: x86-64 (AMD64) is required.
  • Prerequisites: Install basic tools and certificate support.

Before installing Docker, update Ubuntu:

sudo apt update
sudo apt upgrade -y

Install Docker Engine on Ubuntu

To install Docker Engine (the Docker daemon and CLI), use Docker’s official repository. The default Ubuntu repo may have an older docker.io package. To get the latest, follow these steps:

  1. Update APT and install prerequisites. Enable HTTPS support for APT and add required tools: sudo apt update sudo apt install -y ca-certificates curl gnupg lsb-release
  2. Add Docker’s official GPG key. This lets APT verify Docker packages: sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  3. Set up the Docker repository. Add the stable Docker repository for your Ubuntu version (e.g., Jammy): echo \ "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null Replace $(lsb_release -cs) with jammy if needed. This adds Docker packages to APT sources.
  4. Install Docker Engine. Update the package index and install Docker Engine and related components: sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io This installs the Docker daemon (docker-ce), the Docker CLI, and containerd (the container runtime).
  5. Start and verify the Docker service. After installation, Docker starts automatically. Check its status: sudo systemctl status docker The output should show Active: active (running). If it is not active, enable and start it: sudo systemctl enable docker sudo systemctl start docker

Using the commands above installs Docker Engine on Ubuntu. Alternatively, some may install from Ubuntu’s default packages by running sudo apt install docker.io, but this often provides an older version. The official repository method is recommended to get the latest stable release.

Install Docker Desktop on Ubuntu

Docker Desktop offers a graphical interface for managing containers on the desktop. It bundles Docker Engine and Kubernetes support for developers. Docker Desktop for Linux (beta) is available for Ubuntu 22.04 and later. To install Docker Desktop:

  1. Download Docker Desktop for Linux. Go to Docker’s download page and get the latest .deb for Ubuntu. For example, download docker-desktop-x.y.z-amd64.deb.
  2. Install the downloaded package. Use APT to handle dependencies: sudo apt update sudo apt install ./docker-desktop-*.deb You may see a note about unsandboxed downloads; it can be ignored as long as the install finishes.
  3. Launch Docker Desktop. After installation, find “Docker Desktop” in the GNOME/KDE menu and start it. Alternatively, run: systemctl --user start docker-desktop When first run, Docker Desktop will ask you to accept the subscription terms. Accept to continue.

Docker Desktop installs under /opt/docker-desktop. The installer sets up symlinks so that Docker commands in the GUI and CLI work together. After installation, Docker Desktop updates the Docker CLI and Compose on the host (supporting multiple architectures). You can verify versions:

docker --version   # e.g. Docker version 24.x.x
docker compose version   # e.g. Docker Compose version v2.x.x

Note: Docker Desktop is designed for development environments. It provides a GUI and easier management. For headless servers or production, use Docker Engine (the CLI/daemon) as above. Docker Desktop requires a desktop GUI (GNOME/KDE) to launch.

Post-Installation Setup

Post-Installation Setup

After installing Docker, perform these steps to finalize setup and improve usability.

  • Add user to the docker group. By default, Docker commands require root. To run Docker without sudo, add your user to the docker group: sudo usermod -aG docker $USER Then log out and log back in (or run newgrp docker) to activate the new group. Confirm by running groups – you should see “docker” listed for your user. This avoids permission errors. Be aware that this grants root-level privileges for Docker commands, so only use it on trusted machines.
  • Verify Docker without sudo (optional). Try a quick command without sudo: docker ps -a You should see an empty list if no containers have been run. If it fails, check your group membership or use sudo for Docker commands.
  • Update Docker configuration (optional). If you installed Docker on a system with limited memory, you may want to adjust Docker’s storage driver or other settings in /etc/docker/daemon.json. This is advanced, but typically not needed for a basic setup.

Docker Engine now runs on Ubuntu at boot. Docker Desktop also sets itself to start on login.

Testing Docker Installation

Testing is important to confirm Docker works. Use these simple commands:

  • Display Docker info: Run: docker info This shows Docker version, storage driver, number of containers, etc. If Docker is running, it outputs details; otherwise it reports an error.
  • Run a test container: Execute the classic “Hello World” container: docker run hello-world This pulls a tiny “hello-world” image and runs it in a container. If installation is correct, you’ll see output like: Hello from Docker!
    This message shows that your installation appears to be working correctly.
    It verifies Docker can download images and start containers.
  • Try an example container: Pull and run an Ubuntu container with an interactive shell: docker pull ubuntu:latest docker run -it --rm ubuntu bash Inside the shell, run ls, whoami, or install a package with apt. This shows Docker packaging Ubuntu inside a container. Exit by typing exit. The --rm flag removes the container after it stops.
  • Run a simple service: Example: run an Nginx web server: docker run -d --name myweb -p 8080:80 nginx:alpine This command downloads the nginx:alpine image, runs it detached, and maps port 80 in the container to port 8080 on the host. Now open http://localhost:8080 in a browser – you should see the Nginx welcome page. This illustrates hosting a web service in Docker.

These tests confirm that Docker Engine works on Ubuntu. Docker Desktop also provides these capabilities via GUI.

Docker Usage and Adoption

Docker’s popularity continues to grow. In 2023, Stack Overflow developers voted Docker the most-used tool. The JetBrains Dev Ecosystem report found 63% of developers use Docker. Enterprise adoption is high: Datadog notes that while some organizations are moving to other runtimes, a majority still use Docker, and Docker Hub saw billions of image pulls annually. Containers dominate infrastructure; Linux holds over 85% of the container OS market, and Ubuntu is a leading distro.

Even with new tools, Docker remains central to container workflows. According to Datadog’s 2023 report, 65% of container-using organizations still run Docker (though down from 88%). Docker Desktop has millions of users. The Docker Blog reports over 7 million Docker Hub accounts and 3.3 million Desktop installations, with container image downloads in the hundreds of billions. These figures show that “ubuntu install docker” is a valuable skill for many developers.

In practice, teams use Docker on Ubuntu for tasks like:

  • Web development: Packaging applications (Node, Python, Ruby, etc.) into Docker images and running them on Ubuntu servers.
  • CI/CD pipelines: Building and testing code in Docker containers on Ubuntu runners.
  • Microservices: Deploying microservices as containers on Ubuntu clouds.
  • Data science: Running Jupyter notebooks or ML workloads in Docker on Ubuntu workstations.
  • Local development: Using Docker Desktop on Ubuntu for a GUI-based container environment.

Common Docker Commands (Examples)

  • docker run: Create and start a new container from an image. E.g.
    docker run --name myapp -d -p 5000:5000 my-image
  • docker ps: List running containers.
  • docker ps -a: List all containers (including stopped).
  • docker images: List locally downloaded images.
  • docker pull ubuntu:latest: Download an image from Docker Hub.
  • docker stop mycontainer / docker rm mycontainer: Stop and remove containers.
  • docker rmi <image>: Remove an image.
  • docker-compose up: If using Docker Compose, start services defined in docker-compose.yml.
  • docker version: Show client and server Docker versions.
  • docker info: Show detailed info about Docker (system, storage, runtime).

These commands illustrate everyday use. For more, see Docker’s documentation.

Security and Best Practices

A few notes for Ubuntu users:

  • Keep Docker updated. Use apt update && apt upgrade regularly. Docker updates often include security patches.
  • Avoid using sudo if not needed. Use the docker group for convenience, but understand the risk: it grants root-level rights.
  • Use trusted images. Pull official or verified images (look for “Docker Official Images” or publisher alerts on Docker Hub).
  • Minimize privileges. On production, consider running services with minimal capabilities or in user namespaces.
  • Use firewall/ufw. Control container network access with Ubuntu’s firewall.
  • Remove unused images/containers. Free space with docker system prune (careful – it deletes unused data).

Following these practices helps maintain a secure Docker setup on Ubuntu.

Discover Our Services​

Leverage 1Byte’s strong cloud computing expertise to boost your business in a big way

Domains

1Byte provides complete domain registration services that include dedicated support staff, educated customer care, reasonable costs, as well as a domain price search tool.

SSL Certificates

Elevate your online security with 1Byte's SSL Service. Unparalleled protection, seamless integration, and peace of mind for your digital journey.

Cloud Server

No matter the cloud server package you pick, you can rely on 1Byte for dependability, privacy, security, and a stress-free experience that is essential for successful businesses.

Shared Hosting

Choosing us as your shared hosting provider allows you to get excellent value for your money while enjoying the same level of quality and functionality as more expensive options.

Cloud Hosting

Through highly flexible programs, 1Byte's cutting-edge cloud hosting gives great solutions to small and medium-sized businesses faster, more securely, and at reduced costs.

WordPress Hosting

Stay ahead of the competition with 1Byte's innovative WordPress hosting services. Our feature-rich plans and unmatched reliability ensure your website stands out and delivers an unforgettable user experience.

Amazon Web Services (AWS)
AWS Partner

As an official AWS Partner, one of our primary responsibilities is to assist businesses in modernizing their operations and make the most of their journeys to the cloud with AWS.

Conclusion

This guide has shown how to ubuntu install docker on the latest Ubuntu version (22.04 LTS) and beyond. It covered installing Docker Engine via the official APT repository, and installing Docker Desktop (GUI). Key steps included adding Docker’s GPG key, setting up the repository, and running apt install docker-ce docker-ce-cli containerd.io. Post-install, the user was added to the docker group to run commands without sudo. The setup was verified by running docker run hello-world and launching example containers like Nginx.

Container adoption is high: Docker was voted the most-used developer tool, and is used by a majority of teams. Ubuntu, as the leading Linux distro, is an excellent platform for Docker. By following this step-by-step guide, beginners can install Docker on Ubuntu confidently and start leveraging containers in their workflows. The combination of Ubuntu’s stability and Docker’s flexibility empowers developers to build, test, and deploy applications efficiently.