# Installing Docker and Docker Compose on Debian 12

Before installing Docker, ensure your Debian system is up-to-date with the following command:

```sh
sudo apt update && sudo apt upgrade -y
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Once your system is updated, install the necessary packages to allow apt to use a repository over HTTPS:

```sh
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg2 -y
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Next, add the official GPG key of Docker:

```sh
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Add the Docker repository to APT sources:

```sh
echo "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Update your package index and install Docker CE (Community Edition):

```sh
sudo apt update && sudo apt install docker-ce -y
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

To ensure Docker starts on boot, use the following command:

```sh
sudo systemctl enable docker
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Verify the Docker installation by running the hello-world image:

```sh
sudo docker run hello-world
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

## Installing Docker Compose on Debian 12

Docker Compose is a tool for defining and running multi-container Docker applications. To install Docker Compose, first, download the latest version from the official GitHub repository:

```sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Next, set the appropriate permissions to make the binary executable:

```sh
sudo chmod +x /usr/local/bin/docker-compose
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

Verify the installation by checking the version of Docker Compose:

```sh
docker-compose --version
```

<span style="color: rgb(187, 187, 187); background-color: rgba(224, 224, 224, 0.2);">Shell</span>

At this point, Docker and Docker Compose are installed and ready for use on your Debian 12 system.