Docker has been a fundamental part of my setup for more than three years now. Day after day I tried to move as many services as possible to Docker and this was a very good move.
I’ve been able to keep separate environments, optimized for the specific task, safe and replicable. I’ve been able to optimize the server farms, using the same server for different tasks even if different distributions/versions are needed. I’ve been able to move services in seconds, to build some good setups and make sure everything is smooth and stable.
This will be the first of a series of posts, I'll post a new article about this topic every Monday. Each post will cover a specific task/field/service. Like a tutorial, explaining you what I’m suggesting you to do and why. Not just copy&paste.
Let’s start with some basics: Docker is not unique. It’s just a software that uses and manages containerization, which is a long time present feature of the Linux kernel. Docker is just an “interface” to launch (and run, stop, update, etc.) containers in a simple and practical way. There are some good alternatives even if they are less used and known, but have the same efficiency. The first is lxc, which I’ve been using since 2009. It’s different as considers containers like some sort of “small footprint” virtual machines (like openvz, which I’ve been using since 2007).
Installing Docker is quite simple: if you’re using a GNU/Linux supported distribution, all you have to do is:
curl -fsSL https://get.docker.com -o get-docker.sh
Double check the downloaded script before installing, NEVER launch any script you just downloaded without checking
sudo sh get-docker.sh
If everything is ok, you’ll have a running docker environment. Now type:
sudo docker info
To be sure everything is working.
Well done! you’ve just installed your first docker. That was easy, wasn't it? Now you’re ready for the next part. I won't cover the typical "hello world" container but I'll show you how to set up a reverse proxy to put in front of our containers/services.