How-to: Install Docker on Ubuntu 18.04

Installing Docker on Ubuntu 18.04 is as straightforward as executing this Bash script:

#!/bin/bash

sudo apt-get update
sudo apt-get install -y \
    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 \
   $(lsb_release -cs) \
   stable"

sudo apt-get update

sudo apt-get install -y docker-ce
sudo docker run hello-world

You can copy-and-paste the script above or just run it from my Github Gist on a single command-line:

$ curl -s https://gist.githubusercontent.com/justintoo/925b8150fff7484fec82b99341c0d517/raw/135201c325b1d2e07b34c6af69d7a555dc4fc506/install-docker-ubuntu-18.04.sh | bash /dev/stdin

See the official Docker documentation for the latest instructions if these instructions don't work for you.

Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. [ref]

Explore More