Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sharing of OS image resources across multiple docker containers

Tags:

docker

Say I have an n-tier application that requires a DB Image, App Server Image, a load balancer image. Assume all of them are Ubuntu images. The recommendation seems to be use 3 different images and run 3 different containers. In that case what about these two..

1.Since each Image has Ubuntu libraries etc. are all of them going to install the same ubuntu stuff 3 times on my disk, requiring me to allocate that much disk space?

2.Similarly at run time, do those containers make use of the Ubuntu stuff in some efficient way or all of them load everything into the memory independently (again 3 times the duplication)

like image 682
endless Avatar asked Nov 25 '25 13:11

endless


1 Answers

If all three Docker images use the same Ubuntu base image no duplication happens. I suggest you read upon the core Docker architecture to appreciate this. If possible, consider using a lightweight base image such as Alpine or BusyBox rather than a full-blown, fat one such as Ubuntu.

The most important aspect (esp. if you come from a strong VM background) is to think of Docker images as application-level dependency management tools. Yes, they provide isolation. Yes, you can throttle resource consumption. But first and foremost, they are (rather short-lived) application bundle and execution environments.

like image 61
Michael Hausenblas Avatar answered Nov 28 '25 15:11

Michael Hausenblas