Installation

Docker GPG Key

To add the GPG key for the official docker repository, curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Docker-ce

Ubuntu 18.04

If you are using Ubuntu 18.04, run the following commands to add the required Docker repository to apt, upgrade your package lists and grab the docker-ce package.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge"
sudo apt-get -y update && sudo apt-get -y upgrade
sudo apt install docker-ce
Ubuntu 19.04

If you are using Ubuntu 19.04 or any similar bleeding-edge version, you will likely need to append the test branch to the newly configured repository above.
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable edge test"

You should be able to less /etc/apt/sources.list and see the new repository has been added to the end of our file. Generally, the sources.list file should contain the following -

# /etc/apt/sources.list modifications
# Example taken from Ubuntu 19.04 system

...

deb http://security.ubuntu.com/ubuntu disco-security multiverse
deb [arch=amd64] https://download.docker.com/linux/ubuntu disco stable test edge
# deb-src [arch=amd64] https://download.docker.com/linux/ubuntu disco stable edge test
# deb-src http://security.ubuntu.com/ubuntu disco-security multiverse

...
Ubuntu 20.04

If you haven't already, be sure to update your package list by running sudo apt-get -y update && sudo apt-get -y upgrade - this will both update your list of packages, and upgrade your currently installed packages to the newest available versions. Then run sudo apt install docker.io to install Docker.

Docker Compose

To install compose on Ubuntu, run the following commands

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Docker-machine
# Download and install the docker-machine binaries
base=https://github.com/docker/machine/releases/download/v0.16.0 &&
  curl -L $base/docker-machine-$(uname -s)-$(uname -m) >/tmp/docker-machine &&
  sudo install /tmp/docker-machine /usr/local/bin/docker-machine

docker-machine version

# Using the version confirmed by the above command within the next line..
base=https://raw.githubusercontent.com/docker/machine/v0.16.0
for i in docker-machine-prompt.bash docker-machine-wrapper.bash docker-machine.bash
do
  sudo wget "$base/contrib/completion/bash/${i}" -P /etc/bash_completion.d
done

# Tell bash where to find the new file
source /etc/bash_completion.d/docker-machine-prompt.bash