Skip to content

Instantly share code, notes, and snippets.

@mikedamoiseau
Created September 13, 2022 03:51
Show Gist options
  • Save mikedamoiseau/dfac4ddf31994633416bc27807298e58 to your computer and use it in GitHub Desktop.
Save mikedamoiseau/dfac4ddf31994633416bc27807298e58 to your computer and use it in GitHub Desktop.
Install Docker on Ubuntu 20.04

Install Docker on Ubuntu 20.04 Focal

From this page: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04

Step 1 — Installing Docker

  • sudo apt update
  • sudo apt install apt-transport-https ca-certificates curl software-properties-common
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"
  • apt-cache policy docker-ce
    docker-ce:
      Installed: (none)
      Candidate: 5:19.03.9~3-0~ubuntu-focal
      Version table:
         5:19.03.9~3-0~ubuntu-focal 500
            500 https://download.docker.com/linux/ubuntu focal/stable amd64 Packages
    
  • sudo apt install docker-ce
  • sudo systemctl status docker
    Output
    ● docker.service - Docker Application Container Engine
         Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
         Active: active (running) since Tue 2020-05-19 17:00:41 UTC; 17s ago
    TriggeredBy: ● docker.socket
           Docs: https://docs.docker.com
       Main PID: 24321 (dockerd)
          Tasks: 8
         Memory: 46.4M
         CGroup: /system.slice/docker.service
                 └─24321 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
    

Step 2 — Executing the Docker Command Without Sudo (Optional)

Output
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
  • sudo usermod -aG docker ${USER}
  • su - ${USER}
  • groups
    Output
    sammy sudo docker
    
  • sudo usermod -aG docker username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment