# Docker on bullseye (Debian 11)

Debian 11  ["bullseye"](https://bits.debian.org/2021/08/bullseye-released.html) was released on 14th August 2021. In this blog, we will go through the steps of installing `docker` on this new release of Debian.

Installing Docker Engine for the first time on a new Linux host machine requires you to set up the Docker repository for you to install and update Docker.

***Setting up the repository***

Update the `apt` package index and install the below packages to allow `apt` to use a repository over https.
```
$ sudo apt-get update

$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
``` 


![01-docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629022368278/54kIyGBF3.png)

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

```
$ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
Use the following command to set up the stable repository.
```
echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
Also update the `apt` package index using 
```
sudo apt-get update
```
![02-docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629022639547/pgb6r-fY_.png)

***Install Docker Engine***
```
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
```

![03-docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629023233165/fGIUkLhYL.png)

Once the installation is finished you may run the docker command - `docker version` to see the latest docker installed on your new Debian 11 machine.
![04-docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629023181211/pqtjtBYKM.png)

At this moment you should see an error connecting to the `docker` daemon through CLI which is due to the reason the current user doesn't have enough permission. This can be resolved with the below command:
```
sudo usermod -a -G docker $USER
```


> 
The `docker` group grants privileges equivalent to the root user. Check [Docker daemon attack surface](https://docs.docker.com/engine/security/#docker-daemon-attack-surface) to see how this impacts security in your system.

To provide users with a unified resource-control hierarchy, `systemd` now defaults to using control groups v2 (cgroupv2) which got supported in [Docker Engine 20.10](https://www.docker.com/blog/introducing-docker-engine-20-10/). 

![06-docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1629100412400/na3txgpWD.png)

