r/AskComputerScience • u/[deleted] • 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
1
u/KernowRoger Aug 15 '19
First and foremost docker allows you to run your application consistently across many platforms. If it works for me it should (in theory) work anywhere that supports docker. Docker images can also be built from other ones. So when I'm building my aspnetcore rest API I can start with Microsoft's ApsNetCore 2.2 image and simply add my application. That image contains all the prereqs needed to run my site. So now I have a single image containing all prereqs that can be run anywhere. This can then be pushed to a repo and pulled anywhere. Then you can start using k8s. So combined with k8s I can easily have a cluster running across multiple servers with any number of images of my site running with load balancing. K8s will aim to keep X images running. So if one fails it kills it and starts another. We also use rancher which will automatically provision a new aws server if one goes down. Now we have multiple servers with automatic fall over recovery and multiple images spread across those servers with automatic recovery as well. It's also very easy to add auto scaling to the number of containers. This means short of aws going down the site is pretty bullet proof.