Installing Docker and Docker-Compose
This guide will walk you through the steps to install Docker, Jenkins, and set up Jenkins with Docker-Compose.
Prerequisites
- A machine with a supported Linux distribution (Ubuntu 20.04 is used in this guide).
- A user with sudo privileges.
Step 1: Install Docker
-
Update your system:
sudo apt update sudo apt upgrade
-
Install required packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
-
Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
Add the Docker repository:
echo "deb [arch=amd64 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 package database with Docker packages:
sudo apt update
-
Install Docker:
sudo apt install docker-ce
-
Verify Docker installation:
sudo systemctl status docker sudo docker --version
Step 2: Install Docker Compose
-
Download the latest version of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
-
Apply executable permissions:
sudo chmod +x /usr/local/bin/docker-compose
-
Verify Docker Compose installation:
docker-compose --version
Conclusion
You have successfully installed Docker, Docker Compose,
Posted onToolswith tags: