Search code examples
dockervirtualizationlxc

What's the point of running an OS (Ubuntu) in Docker?


I have trouble understanding this concept. I know a little bit about how Docker works and what the benefits are, and while I understand running web servers, databases and development environments in containers, I don't understand the point of running an OS like Ubuntu in Docker.

Can someone explain why you would want to do that and also the benefits of an entire OS in a container?


Solution

  • The OS is essentially the runtime environment required to run your app. If you app is compiled to run on Linux, it relies on Linux libraries (libc, glib, and so on) that must be present in executing environment, regardless of its type. Docker makes no exception to this.

    So a Ubuntu application requires a Ubuntu image in order to run correctly.

    Note that Docker container does not include nor run an entire OS, but only the minimum set of libraries that allow your app to run. In particular it does never contain or execute a kernel, as it runs under the host kernel.