Title: How to Install and Use Docker on Ubuntu 20.04

Title: How to Install and Use Docker on Ubuntu 20.04

Introduction

Docker has become a popular choice for deploying and managing applications in isolated environments. By using containers, Docker enables applications to run in a lightweight, virtualized space without the overhead of a full virtual machine. This flexibility is valuable for developers and IT professionals who want to streamline application deployment and scaling. In this guide, we’ll walk you through installing and using Docker on Ubuntu 20.04.

At Ffon Host, we understand the importance of reliable and easy-to-manage hosting solutions. Docker fits into that by making your deployment process easier, more flexible, and better optimized for resource management.


Prerequisites

  • A server running Ubuntu 20.04
  • A user account with sudo privileges
  • Access to a terminal (SSH or direct server access)

Step 1: Update and Install Required Packages

Start by updating your package index. This ensures that all your software packages are up to date.

sudo apt update

Next, install packages required for Docker:

sudo apt install apt-transport-https ca-certificates curl software-properties-common -y

Step 2: Add Docker’s Official GPG Key and RepositoryDocker provides a GPG key and an official repository. Adding this key and repository ensures you are installing the latest Docker version from trusted sources.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Then add Docker’s official repository to APT sources:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu focal stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Step 3: Install DockerAfter adding the repository, update your package index again:

sudo apt update

Then, install Docker:

sudo apt install docker-ce -y

Docker is now installed. To verify, check the Docker version:

docker --version

Step 4: Start and Enable DockerTo start Docker:

sudo systemctl start docker

To enable Docker to start automatically on boot:

sudo systemctl enable docker

You can confirm that Docker is running with:

sudo systemctl status docker

Step 5: Run Docker Without sudo (Optional)For convenience, you can add your user to the docker group to run Docker commands without sudo.
  • Add your user to the docker group:

  • sudo usermod -aG docker $USER

    1. Log out and back in, or use newgrp docker to apply the group change without logging out.

    2. Now you can run Docker commands as a regular user.Step 6: Test Docker InstallationLet’s verify Docker is working by running a test container. Docker offers a simple test image, hello-world, which will confirm everything is set up correctly.

    docker run hello-world

    If everything is working, you’ll see a confirmation message from the Docker Engine, indicating that the installation was successful.

    Post Your Comment

    Network Service Status

    All Services working

    Website Hosting that doesn't cost the earth

    Superfast, UK website hosting, with advanced features.

    Sign up to our newletter






    Marketing permission: I give my consent to Ffon Host to be in touch with me via email using the information I have provided in this form for the purpose of news, updates and marketing.

    What to expect: If you wish to withdraw your consent and stop hearing from us, simply click the unsubscribe link at the bottom of every email we send or contact us at notifications@ffon.uk. We value and respect your personal data and privacy. To view our privacy policy, please visit our website. By submitting this form, you agree that we may process your information in accordance with these terms.


    A Ffon Solutions Limited Brand Registered in England and Wales 14646146

    Contact us