I am by no means an expert with Docker, in fact, I have barely even scratched the surface in knowing how to effectively use Docker to its full capacity. I have found it extremely useful though to use as a platform for quickly standing up applications for which a Docker image is available. At work I currently use it for Uptime-Kuma (an excellent open source monitoring tool) and Dashy (a great open source dashboard tool). The trickiest parts for me personally have been around getting Docker on a machine and then getting the application I stand up as a Docker container accessible to the real world and not just the local host (oh there will be post on that for sure!).
By far the easiest way to install Docker on Linux is to use Dockers install script which will make security experts cringe because we’re passing it right to the shell. I would not do this with any old software on the Internet because it’s dangerous, but I personally feel secure enough using it because it’s coming from Docker. If you aren’t comfortable doing this there are plenty of other ways to get it installed, I just promised you the easiest way! The command to install Docker via script is below:
curl -sSL https://get.docker.com/ | sh
Once you run through the install you can verify operation by using the following command (that is literally all it takes to get Docker on your machine beside one VERY IMPORTANT STEP which is at the end of the post):
docker run hello-world
You should get a response that looks like the following:
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
719385e32844: Pull complete
Digest: sha256:88ec0acaa3ec199d3b7eaf73588f4518c25f9d34f58ce9a0df68429c5af48e8d
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
You should also be able to verify the version installed by using the following command:
docker version
The output of mine at the time of writing this was:
Client: Docker Engine - Community
Version: 24.0.6
API version: 1.43
Go version: go1.20.7
Git commit: ed223bc
Built: Mon Sep 4 12:31:44 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.6
API version: 1.43 (minimum version 1.12)
Go version: go1.20.7
Git commit: 1a79695
Built: Mon Sep 4 12:31:44 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.24
GitCommit: 61f9fd88f79f081d64d6fa3bb1a0dc71ec870523
runc:
Version: 1.1.9
GitCommit: v1.1.9-0-gccaecfc
docker-init:
Version: 0.19.0
GitCommit: de40ad0
VERY IMPORTANT STEP: That last thing to do is to add your username to the docker group in /etc/group
. If you don’t do this you’re going to have issues and will most likely need the sudo command to do anything Docker related and you really don’t want to be running Docker as root…ever.
It should be the last group in the file and looks similar to the snippet below once you have updated it (substitute your username in place of “johndoe”).
docker:x:999:johndoe
Thanks,
Rob