Today we’re going to learn how we can install Docker and Docker Compose on Debian very quickly.
![](https://i0.wp.com/images.pexels.com/photos/1726246/pexels-photo-1726246.jpeg?w=1200&ssl=1)
First, we add the Debian repository keys.
# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
Now we install the latest version of Docker
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Run Docker
sudo docker run hello-world
We can configure so that we don’t need to use the sudo command to launch Docker (https://docs.docker.com/engine/install/linux-postinstall/):
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
Finally, Docker will work without the need for sudo command
docker run hello-world
*To run docker-compose we’ll use:
docker compose <command>
![](https://i0.wp.com/devcodelight.com/wp-content/uploads/2023/07/cropped-light_logo-5.png?resize=100%2C100&ssl=1)