1 min read

Installing Docker CE & Docker Compose On Ubuntu 18.04

Installing Docker CE & Docker Compose On Ubuntu 18.04

Install Docker from the Official Docker Repository

Install the Dependencies

Docker has its own repositories. Before you can install it from those repos, you need to install the prerequisite dependencies. Update your system, and grab them with Apt.

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common

Add The Docker Repository

Create a new file for the Docker repository at /etc/apt/sources.list.d/docker.list. In that file, place one of the following lines choosing either stable, nightly or edge builds:

sudo nano /etc/apt/sources.list.d/docker.list

deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable

Next, you need to add Docker's GPG key.

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Once, that's imported, update Apt again.

sudo apt update

Install Docker CE

You can simply install the Docker CE package.

sudo apt install docker-ce

Done. Check for docker version:

docker --version
Docker version 18.03.0-ce, build 0520e24

Install Docker Compose

Run this command to download the latest version of Docker Compose:

sudo curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose

Apply executable permissions to the binary:

sudo chmod +x /usr/local/bin/docker-compose

Test the installation.

docker-compose --version
docker-compose version 1.22.0, build 1719ceb