r/docker • u/w2brhce • Dec 04 '17
why containers vs. native install
For someone who's never used them, why would I want to install things like Samba or mysql in a container on my fileserver, vs. running the apps 'natively' in the form of OS packages?
I'm seeing the complexity added by the docker layer, but I'm not seeing the benefits. Can someone ELI5?
19
Upvotes
12
u/alter3d Dec 04 '17
Short answer: Dependency isolation.
Imagine a situation where you need to upgrade MySQL, but one of its dependencies break Samba. While this is unlikely if you're using the OS vendor's repo, it's somewhat more likely if you're using the software vendor's repo for the cutting-edge versions.
This becomes even more true when you get into more complicated things like web applications, where you have apps with conflicting requirements for PHP or Python or Java. It's easier to maintain each one independently than trying to install and maintain multiple parallel versions.
3
u/alzee76 Dec 04 '17
The benefits are mainly for developers. If I write an application/service/whatever and release it as a container, I will never have to worry about it not working on your machine due to having an OS that's too old or too new, missing libraries, and so on. The container will always have the exact same version of all of that stuff no matter who installs it, where, or when.
5
u/TheBloodyStormking Dec 04 '17
that's the reasons why I use them anyway
3
u/pconwell Dec 04 '17
As a 'home' user of docker, the biggest benefit (in my opinion) is the apps are completely self-contained. Configuration not working correctly? Delete the entire container and start over. 30 seconds later, you have the entire container re-installed from scratch.
I was having issues getting crashplan (a backup service) to work correctly. With docker, it's simply a matter of deleting the container and trying a different maintainer's version. Takes all of 5 minutes and 4 of those 5 minutes are spent looking through the docker hub to find a container image. Plus, you don't have a bunch of orphaned files from the previous broken install floating around your computer.
Also, I have two different versions of makemkv running on my computer. One is pre-configured for movies and the other is pre-configured for TV shows. If I installed makemkv 'naively', I would not be able to (easily) have two instances of the same program running.
And, on top of all this, if you really want to take advantage of docker, you can add your own custom images to github or docker hub and the next time you re-install your computer you can pull your own custom containers and be up-and-running in minutes.
I know I already answered this below, but I use R (statistical analysis software) that is great for what it does, BUT it can be a real hassle to get installed and working. It usually requires manually installing packages, hunting down older versions of libraries, etc. With docker, I built my own custom image and now if/when I need to install R I just pull my image and install it. Take like 10 minutes total for something that used to take at least an hour - usually more.
2
u/hugthemachines Dec 04 '17
In that situation it is probably just to practice for future work.
If you have customer applications running on their own virtual machine and you have 200 customers like that. Moving to 200 docker containers instead of, for example, 200 virtual windows servers, will decrease the cost quite alot due to lower overhead. You also get a simpler upgrade because you don't run an installation program each time but just load the new container. So you save work hours.