Fast Way: How To Install Docker and Docker Compose on Linux
Yassine Sellami
Posted on September 14, 2022
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
Or, All in one :
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
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
Or newer project from:
sudo apt-get install docker-compose-plugin
-- If you prefer the old style, create an alias:
alias docker-compose='docker compose'
💖 💪 🙅 🚩
Yassine Sellami
Posted on September 14, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.