
I started playing with docker while I just had a raspberry pi. I had tried to use it for a few apps on a Synology for a client, but it was a bit hard to get my head around. I think I can well and truly say that my head is around it now.
So what is docker?
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. The service has both free and premium tiers. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc
Wikipedia
But what does that mean? well for me, and the way I am using docker (more as a consumer than a creator) It is a fast and easy way to deploy pre-built applications without the need to go through dependency hell. With just a very simple command, say for example…
$ docker run --name mynginx1 -p 80:80 -d nginx
you can have a webserver up and running on port 80 in a matter of seconds (depending on your internet speed). Docker also has a feature, called docker compose which lets you use a YAML file to setup (compose) a collection of images, networking, and settings together, and launch with an even simpler command.
Version: '3'
services:
homarr:
container_name: homarr
image: ghcr.io/ajnart/homarr:latest
restart: unless-stopped
volumes:
- ./homarr/configs:/app/data/configs
- ./homarr/icons:/app/public/icons
ports:
- '7575:7575'
And once you have saved that file as docker-compose.yml all you need to do is run
docker-compose up -d
And that will start and detach your containers.
Docker Compose can get as deep as you want it, and also allows you to put in environment variables in the yaml file, or import them from .env files. this makes it so easy to bring up a stack (WordPress + MariaDB for Example) then all you need to do is log in and start blogging (like me right now).
Docker can do much more than what I am using it for, including some cool networking stuff which I will get into later, and there is a heap of interesting things like docker swarm, and then even moving docker containers into kubernetes.