r/AskComputerScience • • Aug 14 '19

Docker

What problem does docker (and containers) solve? And in which projects should it (or not) be used?

Maybe an Eli5 because I made a long research and didn't get an answer yet.

37 Upvotes

17 comments sorted by

View all comments

Show parent comments

2

u/HasFiveVowels Aug 15 '19 edited Aug 15 '19

It seems everyone always eschews the benefits of docker without looking at the drawbacks. I have about 10 years of experience designing, building, and maintaining web applications, some that host hundreds of thousands of users and others that handle all sorts of high volume communications. My opinion of docker comes from my experience in this role. About 5 years ago, during the height of docker mania, I gave it a go on one of my projects. And I learned I gained basically nothing that wasn't already a trivial concern and what I lost was stuff like the ability to interact directly with the OS, its networking, etc. It seems everything has this additional layer of complexity. And... for what? Easier deployment? How many deployments are you doing, exactly? And, also, if you're working on a project like this I would guess you're using AWS or Google Cloud Services to host it and, if you are, just make a disk image of the install and deploy instances. Instances are basically docker containers already and come with a full API for managing them. Furthermore, why is it necessary for these applications to have this Java-y "write once, run anywhere" aspect? These are servers! You have full control over the environments! (edit: just realized that I take for granted that my computer is MacOS and I run on linux, so dev environments is never an issue for me) Managing environments is not such an overwhelming task that it needs a solution that involves this entire pseudo-VM to run your application in. If it is, then I would assume you're working on a "very heavy project" (as I alluded to in my previous comment). A lot of the things that docker solves are things that should be possible with a small script or that just aren't that big of a concern for projects of a moderate size. Just my two cents and I know others disagree but, IMHO, docker's not all it's cracked up to be.

1

u/011101000011101101 Aug 15 '19

I haven't gone through the process of creating aws amis so I don't know how easy or hard that is. However at my company they didnt want to give us access to create AMIs citing security concerns. So our options are ec2 with puppet, ansible, or something similar, or docker + ECS/EKS.

As for "how many deployments are you doing?".. to production, maybe a couple times a week. To non-production for testing or staging, as a team of 4 we probably deploy 20 or so times a week on average. It only takes a few minutes to test build and deploy, so we run the whole pipeline to make sure our branches are fully functional.

1

u/HasFiveVowels Aug 15 '19

By "how many deployments", I meant concurrent processes rather than code pushes. Unless your dependencies are tied strongly to the OS and frequently changing, there's no real need for that kind of encapsulation. It's naturally going to depend on the project but in my experience, an issue with dependency management is something that should be sorted out on the OS level, not a VM level.

All this said, docker isn't worthless and there are situations where it would be beneficial (e.g. in your situation where access to certain things is restricted due to security concerns). But I've seen it sold as this generalized solution to a general problem and, it seems to me, that unless you have a specific reason for using docker, you shouldn't be using it.

1

u/011101000011101101 Aug 16 '19

By "how many deployments", I meant concurrent processes rather than code pushes

Well my last project would have ~100 instances of the same service pointing at different databases. We'd build the code, docker image, and deploy to update all of them about a half hour. Is that what you meant or am i still not getting it?

1

u/HasFiveVowels Aug 16 '19

Yea, that's what I meant. That's a crazy number of instances, though. Couldn't you just do multi-tenancy and load balance those? Seems like you must have had a significant amount of waste. Or were all those databases read replicas? Why so many instances each with a dedicated DB?

1

u/011101000011101101 Aug 16 '19

Our production sql database cluster is around 100 separate servers just for the primaries. Then we have multiple backups on top of that, but we were connecting to the primaries. And the nature of the application needed independent services for each database instance.

...and all those servers really are necessary because peak cpu on the databases usually hit around 60% or so on a normal day. I think our service uses about 2500 cores in aws during peak traffic.

Keep in mind the databases are for much more than just the service I was working on.