# Installing Docker and Docker Compose

**URL:** <https://forum.hhf.technology/t/installing-docker-and-docker-compose/308>\
**Category:** Servers\
**Tags:** docker-compose, docker\
**Created:** [October 28, 2024, 10:53am UTC](https://forum.hhf.technology/t/installing-docker-and-docker-compose/308 "2024-10-28T10:53:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [October 28, 2024, 10:53am UTC](https://forum.hhf.technology/t/installing-docker-and-docker-compose/308/1 "2024-10-28T10:53:14Z")

</div>

## **Installing Docker and Docker Compose**

Docker and Docker Compose are essential tools for creating, deploying, and managing containerized applications. This guide provides a step-by-step walkthrough on how to install Docker and Docker Compose on various operating systems.

### **Prerequisites**

Before we start, ensure that you have:

- A supported operating system (Linux, Windows 10/11, macOS)
- Internet access to download Docker and Docker Compose
- Sudo or administrator privileges

### **Installing Docker**

#### **Installing on Linux**

**Update your package index** :

```auto
sudo apt-get update

```

**Install required packages** :

```auto
sudo apt-get install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

```

**Add Docker’s official GPG key** :

```auto
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

```

**Set up the stable repository** :

```auto
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 &amp;gt; /dev/null

```

**Install Docker Engine** :

```auto
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

```

**Verify installation** :

```auto
sudo docker --version

```

#### **Installing on Windows**

**Download Docker Desktop for Windows** :  
Visit [Docker Hub](https://hub.docker.com/editions/community/docker-ce-desktop-windows) and download the Docker Desktop Installer.

**Run the Installer** :  
Follow the on-screen instructions to complete the installation.

**Verify installation** :

```auto
docker --version

```

#### **Installing on macOS**

**Download Docker Desktop for Mac** :  
Visit [Docker Hub](https://hub.docker.com/editions/community/docker-ce-desktop-mac) and download the Docker Desktop Installer.

**Run the Installer** :  
Open the `.dmg` file and drag Docker to the Applications folder.

**Start Docker** :  
Open Docker from the Applications folder.

**Verify installation** :

```auto
docker --version

```

### **Installing Docker Compose**

#### **Installing on Linux**

**Download the Docker Compose binary** :

```auto
sudo curl -L "https://github.com/docker/compose/releases/download/$(sudo curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

```

**Apply executable permissions** :

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

```

**Verify installation** :

```auto
docker-compose --version

```

#### **Installing on Windows**

**Download Docker Compose** :  
Docker Compose is included with Docker Desktop. Make sure the Docker Desktop is running.

**Verify installation** :  
Open Command Prompt or PowerShell and run:

```auto
docker-compose --version

```

#### **Installing on macOS**

**Download Docker Compose** :  
Docker Compose is included with Docker Desktop. Make sure the Docker Desktop is running.

**Verify installation** :  
Open Terminal and run:

```auto
docker-compose --version

```

### **Post-Installation Steps**

**Create Docker Group** (Linux only):

```auto
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

```

**Enable and Start Docker** (Linux only):

```auto
sudo systemctl enable docker
sudo systemctl start docker

```

### **Troubleshooting**

**Docker Daemon Issues** :  
Verify the Docker service is running:

```auto
sudo systemctl status docker

```

**Permission Denied Errors** :  
Ensure your user has the appropriate permissions and is part of the ‘docker’ group.

**Network Issues** :  
Check firewall settings and ensure Docker is allowed through.

Feel free to reach out for more help through Docker’s community forums or their official documentation.
