Previous Page

nihilist - 29 / 08 / 2020

Docker Installation

Here is a tutorial on how to install Docker on debian-based distros quickly:

Initial Setup

Right now i'm running a debian virtual machine using QEMU KVM virt-manager you can see my tutorial for that here. It is a default debian10 distribution with ssh server on it:

Installing Docker

In most cases you want to use one of these 2 commands:

curl -fsSL -o 


apt install

and once that's done we can verify that docker is installed by typing the following commands:

root@nowhere:/home/nothing# which docker && docker -v
Docker version 18.09.1, build 4c52b90

And that's it! We have been able to install docker on our debian machine.

Testing Docker

Now that's done we'll test if docker works by pulling in an application we find on docker hub, one of the most popular containers out there is nginx, so let's first pull it to our local machine and see if it works:

root@nowhere:/home/nothing# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
bf5952930446: Pull complete
cb9a6de05e5a: Pull complete
9513ea0afb93: Pull complete
b49ea07d2e93: Pull complete
a5e4a503d449: Pull complete
Digest: sha256:b0ad43f7ee5edbc0effbc14645ae7055e21bc1973aee5150745632a24a752661
Status: Downloaded newer image for nginx:latest

root@nowhere:/home/nothing# docker container run -d -p 8080:80 --name mynginx nginx

root@nowhere:/home/nothing# docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
671bc01b6a10        nginx               "/docker-entrypoint.…"   22 seconds ago      Up 22 seconds>80/tcp   mynginx

Here we pulled nginx's container image, and ran it redirecting it's port 80 to our machine's port 8080 so let's check it out:

root@nowhere:/home/nothing# ip a | grep inet
    inet scope host lo
    inet6 ::1/128 scope host
    inet brd scope global dynamic enp1s0
    inet6 fe80::5054:ff:fee0:b0fa/64 scope link
    inet brd scope global docker0
    inet6 fe80::42:2dff:fe19:e6b4/64 scope link
    inet6 fe80::34e2:53ff:fef1:5763/64 scope link

And there you have it! we have been able to run a docker container on debian. However when we restart the machine, the container isn't running when we get back into our system, so we need to make sure the running container image runs at startup, after reading the documentation we do the following:

root@nowhere:/home/nothing# docker container run -d --restart unless-stopped -p 8080:80 --name mynginx4 nginx
root@nowhere:/home/nothing# docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
681d739d9811        nginx               "/docker-entrypoint.…"   4 seconds ago       Up 4 seconds>80/tcp   mynginx4

We reboot the machine and see if our nginx container is still up:

And it is! That concludes our tutorial.


Until there is Nothing left.

About nihilist

Donate XMR: 8AUYjhQeG3D5aodJDtqG499N5jXXM71gYKD8LgSsFB9BUV1o7muLv3DXHoydRTK4SZaaUBq4EAUqpZHLrX2VZLH71Jrd9k8

Contact: (PGP)