How to install and configure Docker in Ubuntu?

Install-Setup-Docker-in-Ubuntu-min

Install Docker from Ubuntu Repository

  • $ sudo apt install docker.io

Below command will start Docker and ensure that starts after the reboot:

  • $ sudo systemctl start docker
  • $ sudo systemctl enable docker
  • $ docker –version

Output:

Docker version 17.03.2-ce, build f5ec1e2

Docker Login

  • $ sudo docker exec -it docker /bin/bash

Install the Dependencies

  • $ sudo apt update
  • $ sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add Docker Repository

Create a new file for the Docker repository at /etc/apt/sources.list.d/docker.list. In that file, place one of the following lines choosing either stable, nightly or edge builds:

  • sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable”

Next, you need to add Docker’s GPG key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –