This document is a guide for installing docker and docker compose to an Ubuntu server.
Installing Docker
- Update and upgrade system repository and system packages
1 2
$ sudo apt update $ sudo apt upgrade
- Install docker dependencies
1
$ sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
- Add Docker repository to system resources
1 2 3
$ sudo snap install curl $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg $ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Update and upgrade system packages
1 2
$ sudo apt update $ sudo apt upgrade
- Install Docker
1
$ sudo apt install docker-ce
- Check docker status and version
1 2
$ sudo systemctl status docker $ docker --version
Installing Docker Compose
- Install Docker Compose using apt
1
$ sudo apt install docker-compose
- Check docker-compose version
1
$ docker-compose --version
Done!