DEV Community

Cover image for Fast Way: How To Install Docker and Docker Compose on Linux
Yassine Sellami
Yassine Sellami

Posted on • Edited on

1 1

Fast Way: How To Install Docker and Docker Compose on Linux

Docker

-- update packages: 
sudo apt update

-- install prerequisite packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common

-- Add 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 to APT sources:
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 packages again:
sudo apt update

-- Check Docker repo:
apt-cache policy docker-ce

-- install Docker
sudo apt install docker-ce

-- Check that it’s running:
sudo systemctl status docker

Enter fullscreen mode Exit fullscreen mode

Or, All in one :

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Enter fullscreen mode Exit fullscreen mode

Docker Compose

-- Download docker compose v2.11.0
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.11.0/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose

-- Permissions to docker compose:
chmod +x ~/.docker/cli-plugins/docker-compose

-- Verify the installation
docker compose version
Enter fullscreen mode Exit fullscreen mode

Or newer project from:

sudo apt-get install docker-compose-plugin
Enter fullscreen mode Exit fullscreen mode
-- If you prefer the old style, create an alias: 
alias docker-compose='docker compose'
Enter fullscreen mode Exit fullscreen mode

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs