# Install Docker on Debian

#### 🚀 One-Line Download &amp; Execute

```bash
apt install -y curl && curl -sSL https://docs.greenhome.stream/attachments/37 -o install_docker_portainer.sh && chmod +x install_docker_portainer.sh && ./install_docker_portainer.sh
```

### Method A :

#### 1. Install Docker on Debian 12

Before you install Docker Compose and Portainer, ensure that Docker is installed on your Debian 12 system.

##### Step 1: Update and Install Dependencies

```bash
apt update
apt install -y apt-transport-https ca-certificates curl
```

##### Step 2: Add Docker’s Official GPG Key

```bash
curl -fsSL https://download.docker.com/linux/debian/gpg | tee /etc/apt/trusted.gpg.d/docker.asc
```

##### Step 3: Add Docker's Official Repository

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

##### Step 4: Install Docker

```bash
apt update
apt install -y docker-ce docker-ce-cli containerd.io
```

##### Step 5: Verify Docker Installation

```bash
docker --version
```

### Method B :

#### 2. Install Docker Compose and Enable APT Updates

##### Step 1: Add Docker Compose APT Repository

Docker Compose is not included in the default Debian repositories, but you can use Docker’s official repository for Compose.

Create a Docker Compose APT repository source:

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

##### Step 2: Install Docker Compose

Now, install Docker Compose from Docker's APT repository:

```bash
apt update
apt install -y docker-compose-plugin
```

This version of Docker Compose (the plugin version) integrates directly into the Docker CLI and will update with**` apt update `**and`<strong> apt upgrade.</strong>`

##### Step 3: Verify Docker Compose Installation

```bash
docker compose version
```

---

### Method C :

#### 3. Install Portainer Using Docker Compose (Optional)

Portainer is a popular web UI to manage Docker environments. You can easily deploy it using Docker Compose.

##### Step 1: Create the docker-compose.yml File

Create a`<strong> docker-compose.yml </strong>`file in a directory where you want to manage Portainer. You can place it anywhere you like, but let’s say you create a directory called`<strong> portainer </strong>`:

```bash
mkdir -p ~/portainer
cd ~/portainer
```

Now create the docker-compose.yml file using your favorite editor:

```bash
nano docker-compose.yml
```

Paste the following content for the Portainer setup:

```yaml
version: "3.9"
services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: always
    networks:
      - portainer_network
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
    ports:
      - 9000:9000
    environment:
      - TZ=Europe/Athens  # Set your timezone

networks:
  portainer_network:
    driver: bridge

volumes:
  portainer_data:
    driver: local
```

##### Step 2: Start Portainer

Once the`<strong> docker-compose.yml </strong>`file is ready, run the following command to start Portainer :

```bash
docker compose up -d
```

This will pull the Portainer image, create the necessary containers, and start the Portainer web UI. You can now access it by going to `<strong>http://<your-server-ip>:9000 </strong>`in your web browser.

##### Step 3: Access Portainer

When you visit Portainer for the first time, you'll be prompted to set up an admin account. After that, you can start managing your Docker environment through the web interface.

---

### Method D :

#### 1. Install Docker

##### Step 1:

Install docker using the official script, by executing the below command.

```bash
curl -fsSL https://get.docker.com | sh
```

---

### Check Update :

#### 4. Ensure Automatic Updates for Docker and Docker Compose

Since you added Docker’s official repositories, Docker Compose will be updated via the same process as Docker itself when you run :

```bash
apt update && apt upgrade -y
```

#### Summary

1. **Docker** : Installed and running using the official Docker repositories.
2. **Docker Compose** : Installed via Docker's APT repository and integrated with Docker.
3. **Portainer** : Deployed using Docker Compose, with an example`<strong> docker-compose.yml </strong>`file to start the Portainer service.

You should now have Docker, Docker Compose, and Portainer running on Debian 12, with updates managed through`<strong> apt </strong>`.

### Download the files

#### Script universal-health-monitor.sh

Attachment link : [install\_docker\_portainer.sh](https://docs.greenhome.stream/attachments/37 "Install Docker Portainer")

<span style="color: rgb(224, 62, 45);">**Ins0mniA**</span>