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

5

u/011101000011101101 Aug 15 '19

Others have covered a lot of the benefits well, but there are some downsides. The main one i know of is when you need high performance storage. With the native way to mount storage into a running docker container, docker creates overlay storage. So basically you have a virtualized hard drive. I was working on deploying a service to AWS that works well with seqiential scan drives (HDDs), so we were using st1 storage from EBS. However once you have the docker overlay all the benefits you get from the st1 storage in this case are lost.

So basically anything that needs to be highly optimized could benefit from deploying via something like puppet or ansible instead of docker. Any data store is probably best to go without docker unless you're putting very little load on it.

5

u/seabrookmx Aug 15 '19

This is easily solved with a volume mount. The overlayfs is only used when you write to the main filesystem that is backed by the docker image.

It definitely adds to the complexity of the deployment, but I wouldn't immediately jump to "deploy with puppet or ansible" if you need fast storage.

We have a few projects that deploy their main databases as docker containers (in a Kubernetes cluster) and performance is exactly the same as it was on a vanilla EC2 instance or XenServer instance. Which is expected as our Kubernetes hosts are also backed by EC2.

1

u/011101000011101101 Aug 15 '19

Maybe our people that set it up fucked it up then. I didn't dig too deep into the docker setup in this instance, but i was running performance tests against one deployed with cloud formation + puppet and one deployed with docker and the performance took a major hit. However we switched the drives to gp2 and the performance went back up a bit. Still not as good, but good enough in this case.