|
|
|
|
|
by tunesmith
821 days ago
|
|
For me, I have a cheap cloud server that handles multiple low-traffic personal websites, side projects, etc. Each project has a different tech stack and it can be months or years before I circle back to one to bring it up to date. I don't want to wrestle with making sure that I have the right versions of php and apache for my ubuntu. Having them all as docker containers makes it a lot easier, and a lot easier to move to new servers, too. |
|
I can give them resource limits the same way (CPU/memory limits, except easier than cgroups), as well as set restart policies and have a clear look at what's executing where, with something like Docker Swarm it becomes like systemd across multiple nodes and scaling up/down becomes easy, especially with load balancing for network calls. Software like Portainer also has pretty nice discoverability.
Speaking of networking, I don't have to worry about tunnels or firewall configuration myself, can just expose a web server that acts as a reverse proxy and give everything else custom private networks that span across nodes (with something like Docker Swarm again, though Consul and Kubernetes have the same functionality, details aside).
I can have custom port mappings (regardless of what the software uses, I might not even care about digging in some configuration file to change it), which is especially useful when running multiple separate instances on the same machine (like different versions of PostgreSQL, or separate instances for different projects), or hostnames in case I don't want to expose ports.
I can easily have custom persistent/transient storage paths or even in memory storage (tmpfs), when I have persistent storage then suddenly backups become easy to do and I can be very clear about all other directories being wiped and being in a known state upon startup/restart. It's also immensely useful for me to escape the sometimes weird ways how software on *nix uses the file system, I can just mount my persistent files in /app/my-app/database/var/lib/postgresql/data or /app/my-app/web-server/etc/apache2/sites-enabled and know that I don't care about anything outside of /app.
I can also treat Docker as lightweight VMs, except a bit more stateless, in that I can have container images that I base on a version of Debian/Ubuntu/Alpine or whatever, ship them, and then don't have to worry about a host OS update breaking something, because only Docker or another runtime like Podman is the actual dependency and most of the other software on the node doesn't come in contact with what I'm running. With rootless containers, that also improves the separation and security there a little bit.
With all of that in place, suddenly I can even move apps and all of their data across nodes as necessary, load balance software across multiple nodes, be able to easily tell people how to run what I have locally and store and later use these images very easily. Are there pieces of software or alternatives (e.g. jails) that do a lot of the same? Sure, but Docker essentially won in ease of use.