# How to install Docker on Linux Mint 21 Vanessa

Everyone is using Docker nowadays. Main reasons include ease of development and rapid deployment. Why bother downloading and installing the required dependencies to start using your preferred programming language when you can do that out of the box with a few commands in your terminal. Thanks to Docker, you can just run a simple command and start using your software instantly. You can also package (a.k.a create an image of) your application with the required dependencies, easily share it, and run it anywhere. It is no wonder that Docker has become a crucial ingredient of a developer's toolset. 


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664832129216/l4oW98zVI.png align="center")

# Installing Docker 

Let's first update the `apt` package index and install some required packages:

```bash
sudo apt update

sudo apt install ca-certificates curl gnupg
``` 

We need to add Docker’s GPG key

```bash
 sudo mkdir -p /etc/apt/keyrings

 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
```

Then use this command to add the repository to `sources.list.d`

```bash
# Please note that we are using Ubuntu Jammy's repo
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu jammy stable" \
| sudo tee /etc/apt/sources.list.d/docker.list
```

Now we can install Docker Engine 

```bash
sudo apt update
#  Install the latest version of Docker Engine, containerd, and Docker Compose
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
```

# Using Docker as a non-root user

To avoid prefacing docker commands with `sudo` we will create [the `docker` group](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) and add the current user to it. 

```bash
sudo groupadd docker
sudo usermod -aG docker $USER
```

All you have to do now is to **log out and log back in again**. Then, verify that you can run docker commands without `sudo` by running `docker run hello-world`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1664833252551/2NsgHrq_8.png align="center")

