Omonbude Emmanuel
Software Engineer
  • Residence:
  • Phone:
  • Email:

How to install docker in Ubuntu server

Omonbude Emmanuel | Nov. 6, 2023, 1:09 p.m.



In the ever-evolving world of software development and server management, efficiency and scalability are the keys to success. Docker, a powerful containerization platform, has revolutionized the way we build, deploy, and manage applications. Its ability to isolate applications and their dependencies within lightweight, portable containers makes it a game-changer for developers and system administrators.

By the end of this tutorial, you'll not only have Docker up and running on your Ubuntu Server but also a foundational understanding of Docker's core concepts and basic commands. You'll be ready to deploy and manage applications more efficiently, enhance system security, and join the ranks of those who have embraced containerization to simplify their workflows.

So, let's dive in and unlock the potential of Docker on your Ubuntu Server. Get ready to containerize, deploy, and scale your applications like a pro!


Before you begin the installation process, ensure that you have the following prerequisites in place:

  1. Ubuntu Server: You should have an Ubuntu Server instance set up and ready. 

  2. SSH Access: You should have SSH access to your Ubuntu Server. This is typically used to connect to the server remotely and run commands. Make sure you have an SSH client installed on your local machine.

  3. Sudo Privileges: You need to have sudo privileges on the Ubuntu Server. This is important because some of the Docker installation steps require elevated permissions. If you're not sure whether your user has sudo privileges, you can check by running sudo -l on the server.

  4. Basic Command-Line Skills: While this guide is designed to be beginner-friendly, having some familiarity with basic Linux command-line operations can be helpful. If you're new to the command line, consider learning a few essential commands before proceeding.

With these prerequisites in place, you'll be well-prepared to install Docker and begin using it on your Ubuntu Server.


Installing Docker:


Adding Docker's Official GPG Key and Repository

To install Docker on your Ubuntu Server, you need to begin by adding Docker's official GPG key and repository to your system. This ensures that you're fetching and installing Docker from a trusted source. Follow these steps:

  • Add Docker's Official GPG Key:

    Use the following command to add Docker's official GPG key to your system:


    1.  sudo apt-get update

    2. install ca-certificates curl gnupg

    3. sudo install -m 0755 -d /etc/apt/keyrings

    4. curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

    5. sudo chmod a+r /etc/apt/keyrings/docker.gpg 


  •  Add the Repository to Apt Sources:

Once you have Docker's GPG key in place, you need to add the Docker repository to your system's sources list. Use the following command:

  • 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
  • sudo apt-get update

With these steps completed, you have successfully added Docker's official GPG key and repository to your Ubuntu Server, preparing your system for the Docker installation. You can now proceed to install Docker by running sudo apt-get install docker-ce or the specific Docker package you require.

  • Install the Docker packages.

To install the latest version on docker, run:

sudo apt-get install docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin


To install a specific docker version:

If you want to install a specific docker version, follow the following steps below. If you have installed the latest version already, you can skip these steps.

  1. Check Available Docker Versions:

Before installing a specific version of Docker, it's a good practice to check the available versions. You can use the following command to list the available Docker packages:

apt-cache madison docker-ce | awk '{ print $3 }'

       2. Install a Specific Docker Version:

sudo apt-get install docker-ce=$VERSION docker-ce-cli=$VERSION docker-buildx-plugin docker-compose-plugin

          $VERSION is the version of docker you want to install


  • Verifying Docker Engine Installation with the Hello-World Image

Once you have successfully installed Docker on your Ubuntu Server, it's essential to verify that the installation is working correctly. You can do this by running a simple "hello-world" container. Follow these steps to verify your Docker Engine installation:

  1. Open a Terminal: To begin, open a terminal window on your Ubuntu Server. This is where you'll run the Docker commands.

  2. Run the Hello-World Container: Use the following command to run the "hello-world" container:

    sudo docker run hello-world


Now that Docker is at your disposal, you're equipped to streamline your projects and deliver cutting-edge solutions with ease. The Docker community, filled with experts and enthusiasts, is ready to support your journey.

Welcome to the world of Docker, where containers fuel the future of application deployment. Embrace innovation and efficiency, and continue exploring this dynamic technology landscape.

© 2024 Omonbude Emmanuel

Omonbude Emmanuel