Docker Guides

How to install Docker on Ubuntu ?

Docker as we know, is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud. In this post, we are going to take look at how to install Docker on Ubuntu 18 LTS.

Requisites

Ubuntu OS requirements: Docker CE (Community Edition) supports the following 64-bit versions

  • Bionic 18.04 (LTS)
  • Artful 17.10
  • Xenial 16.04 (LTS)
  • Trusty 14.04 (LTS)

For Docker EE (Enterprise Edition) please refer Docker documentation

Install Steps

  1. [Optional Step] this step is required only if you have older versions of the docker, uninstall using below commands
    sudo apt-get remove docker docker-engine docker.io

    Image – Uninstall Docker

  2. Update apt packages
    sudo apt-get update

    Image – Update Packages

  3. Install following Packages
    • apt-transport-https
    • ca-certificates
    • curl
    • software-properties-common
      sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common

      Image – Install Packages

  4. Setup Docker’s official GPG key
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

    Image – Setup Docker GPG Key

  5. Verify key with the fingerprint
    sudo apt-key fingerprint 0EBFCD88

    Image – Verify key

  6. Add Stable repository (this command applies only to x86_64 / amd64 platform)
    sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"

    Image – Add Stable repository

  7. Install Docker CE edition
    sudo apt-get update
    Image – Run apt-get update before install

    sudo apt-get install docker-ce

    Image – Install Docker CE

  8. Verify Docker installation by running the hello-world image
    sudo docker run hello-world

    Image – Verify Docker CE installation

Post Installation Steps

Docker daemon binds to a Unix socket instead of a TCP port. By default, Unix socket is owned by the user root and other users can only access it using sudo command. Docker daemon always runs as the root user. To avoid using sudo command every time follow the below steps:

  1. Create Docker group (must have been already created if not create new)
    sudo groupadd docker
  2. Add current user to Docker group
    sudo usermod -aG docker $USER

    Image – Add current user to Docker group

  3. Verify that you can run docker commands without sudo.
    docker run hello-world

    Image – Validate Docker Installation

Now that we have installed Docker CE, its time to understand a bit about the internals of Docker as well.

Docker components

Docker uses a client-server architecture. Docker client (docker command line interface) talks to the Docker daemon, which does all the heavy lifting of building, running, and distributing our Docker containers. The Docker client and daemon can run on the same system, or there is also an option to connect a Docker client to a remote Docker daemon.

Image – Docker components (Source – Docker)
  1. Docker Daemon: Docker daemon listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes.
  1. Docker client: Docker users interact with Docker using Docker client. When you use commands such as docker run, the client sends these commands to Docker Daemon, which carries them out. The Docker client uses the Docker API.
  1. Docker registry stores Docker images. Docker Hub and Docker Cloud are public registries that anyone can use, and Docker is configured to look for images on Docker Hub by default. There is also an option to run a private registry.
  1. Docker Image is a read-only template with instructions for creating a Docker container. Often, an image is based on another image, with some additional customization.
  1. Docker container is a runnable instance of an image. We can create, start, stop, move, or delete a container using the Docker API or CLI. We can connect a container to one or more networks, attach storage to it, or even create a new image based on its current state.
  1. Dockerfile defines the steps needed to create the image and run it.

In this post, we have learned how to install Docker on Ubuntu 18. There is much more to the Docker platform than what was covered here, but now you would have got a good idea of the different components and how to configure Docker.

For other posts about Docker, check out here.

Like this post? Don’t forget to share it!

Additional Resources:

Summary
Article Name
How to install Docker on Ubuntu ?
Description
Docker as we know,is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.In this post, we are going to take look at how to install Docker on Ubuntu
Author
Publisher Name
Upnxtblog
Publisher Logo
Karthik

Allo! My name is Karthik,experienced IT professional.Upnxtblog covers key technology trends that impacts technology industry.This includes Cloud computing,Blockchain,Machine learning & AI,Best mobile apps, Best tools/open source libs etc.,I hope you would love it and you can be sure that each post is fantastic and will be worth your time.

Share
Published by
Karthik
Tags: dockerubuntu

Recent Posts

Navigating Volatility: Investing in Crypto Derivatives and Risk Management Strategies

The cryptocurrency market is famed for its volatility, presenting each opportunity and demanding situations for…

1 week ago

How Game Developers Use AI in Mobile Games in 2024?

Games since time immemorial have been winning at captivating the users and teleporting them onto…

2 weeks ago

The Impact of AI on Software Development

We are living within an innovation curve wherein cutting-edge technologies are making a hustle and…

2 weeks ago

AI Tools for Research Paper Writing: Learn What They Can Do

Whether it’s the healthcare industry or the automobile sector, artificial intelligence has left its impact…

4 weeks ago

Embracing Innovation: 5 Ways AI is Transforming the Landscape in 2024

Facts only- The big Artificial Intelligence push is unraveling in 2024. No, it wasn’t merely…

4 weeks ago

The Startup Guide to Acquiring Exceptional Developers

In the fiercely competitive world of Hire Developers for Startup, success hinges not just on…

1 month ago

This website uses cookies.