Setting up Docker

<< Installing Ubuntu Server

Now that we have our VM up and running we can go ahead and get Docker setup. We will be using Docker to run all of our services for this guide.

Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.

First we need to SSH to our VM.

# PowerShell/WSL BASH/PuTTy [Hyper-V Host]
ssh [email protected]

It appears that Docker-CE isn’t currently supported on Ubuntu Server 19.04. However you can install it on 19.10. See here. Thanks Tom C! – 2/8/2020

Once you we are logged in we can setup Ubuntu to allow repository connections over HTTPS.

# BASH [Linux VM]
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common -y

Add Docker’s official GPG key:

# BASH [Linux VM]
curl -fsSL | sudo apt-key add -

Now add the stable Docker CE repo:

# BASH [Linux VM]
sudo add-apt-repository "deb [arch=amd64] $(lsb_release -cs) stable"

Update your app repositories and install docker-ce:

# BASH [Linux VM]
sudo apt-get update && sudo apt-get install docker-ce -y

You can then run docker in your cli to verify the installation. This will return the –help for docker. We will also need docker-compose as this will make it easy to deploy our resources.

example output of running docker
# BASH [Linux VM]
sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# BASH [Linux VM]
sudo chmod +x /usr/local/bin/docker-compose

You can add your current user to the docker user group so that you do not have to constantly add sudo to your docker commands.

# BASH [Linux VM]
sudo usermod -aG docker username && sudo reboot now