Skip to content

Instantly share code, notes, and snippets.

@kprasad99
Last active January 21, 2019 17:37
Show Gist options
  • Save kprasad99/ac85133452e30b7aa6cdfd3779aaa163 to your computer and use it in GitHub Desktop.
Save kprasad99/ac85133452e30b7aa6cdfd3779aaa163 to your computer and use it in GitHub Desktop.
Installation and configuration of docker in Ubuntu 18.04

Installation and configuration of docker in Ubuntu 18.04

Install docker package

Below are the steps to install docker in ubuntu 18.04

  • First update existing packages.

$ sudo apt update ; sudo apt upgrade
  • Install utility packages

$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • Add GPG key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Add docker repository to apt sources.

$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
  • Update apt sources and install docker

$ sudo apt update ; sudo apt install docker-ce
  • Verify docker service is started.

$ sudo systemctl status docker

Enable docker command execution without sudo.

  • We need to add user to docker group to enable docker command execution without sudo user.

    • To add current user

      $ sudo usermod -aG docker ${USER}
    • Alternatively to add any other user

      $ sudo usermod -aG docker <username>
  • Verify if user is added is added to docker group by listing the groups the user is added to.

$ id -nG ${USER}
  • Logout and login to session.

su - ${USER}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment