Docker setup in Linux: Setting up docker in Zorin 16.3
Tags: docker, webdev, beginners, devops
Published: 2023-12-29 23:06:56

As Zorin 16.3 is based on `Ubuntu/focal`, there's a little workaround to have a usable docker setup.

## Process

### #1 Install Docker system

As you need to create containers, you need docker to do so. Here's simple process just cited from multiple references.

```bash
# preliminaries
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
```

Need to add keyrings:

```bash
# keyrings
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg — dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
```

Adding `apt` source next:

```bash
echo \
“deb [arch="$(dpkg — print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```

I recommend this step to be done manually if you happen to face any issue. You should shoud be able to have contents as in below in the `/etc/apt/sources.list.d/docker.list` file. I've manually written this after running into a little issue which works like a charm now.

```bash 
deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu   focal stable
```

After that its just installing stuffs:
```bash
# installation just starts now
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

Finally, testing step is as an usual `hello-world` container.

```bash
sudo docker run hello-world
```

Now, you're good to go if you see welcome message running down this `hello-world` container. Go through [this link](https://stackoverflow.com/questions/66374226/e-malformed-entry-1-in-list-file-etc-apt-sources-list-d-docker-list-component) if you've been facing issues with APT repository. [3]

### #2 Docker Desktop

A GUI makes it easy to navigate through the whole docker system. Have a look [here](https://docs.docker.com/desktop/install/ubuntu/) to setup docker desktop after installation of docker system. Here's the summary: [2]

```bash
# if don't exist
sudo apt install gnome-terminal

# removing previous installations
sudo apt remove docker-desktop
rm -r $HOME/.docker/desktop
sudo rm /usr/local/bin/com.docker.cli
sudo apt purge docker-desktop

# install by apt after downloading from the page
sudo apt-get update
sudo apt-get install ./docker-desktop-<version>-<arch>.deb

# launch
systemctl --user start docker-desktop
```

Next time if you want to upgrade the application, its quite easy:

```bash
sudo apt-get install ./docker-desktop-<version>-<arch>.deb
```

Check the whole installation as below:

```bash
docker compose version
Docker Compose version v2.17.3

docker --version
Docker version 23.0.5, build bc4487a

docker version
Client: Docker Engine - Community
 Cloud integration: v1.0.31
 Version:           23.0.5
 API version:       1.42
<...>
```

### #3 Optional: Install kubernetes

As you've installed docker desktop, you can do this installation from the GUI settings in the app quite easily.

## References

1. [https://medium.com/@mahmud0x/setting-up-docker-on-zorin-os-16-3-4892bfb18732](https://medium.com/@mahmud0x/setting-up-docker-on-zorin-os-16-3-4892bfb18732)
2. [https://docs.docker.com/desktop/install/ubuntu/](https://docs.docker.com/desktop/install/ubuntu/)
3. [https://stackoverflow.com/questions/66374226/e-malformed-entry-1-in-list-file-etc-apt-sources-list-d-docker-list-component](https://stackoverflow.com/questions/66374226/e-malformed-entry-1-in-list-file-etc-apt-sources-list-d-docker-list-component)