A Docker OS container - why?

0

If Docker is an application container (unlike a system container like LxC), and is to be used for running only one app/service, I wonder what good is a full, Docker OS container, say, for Ubuntu?

Any one use-case where you'd for example prefer a Ubuntu Docker container, instead of a Ubuntu LxC container?

Harry

Posted 2019-08-03T01:02:51.450

Reputation: 647

Please, for God's sake!, do NOT call this question "too broad" and vote to have it closed. Don't bully us here. – Harry – 2019-08-03T04:49:27.913

1There are “OS images” for most popular Linux distributions. They are typically used to build application images upon. Is that perhaps what you’re confused about? – Daniel B – 2019-08-03T15:47:12.757

@DanielB Yup, looks like it. Wish, this was explained CLEARLY early on in Docker documentation. Almost every article or tutorial uses a Ubuntu (or another OS) image (WHILE ALSO calling Docker an app container) without ever expressly stating what you just stated. Thanks. – Harry – 2019-08-04T00:46:13.117

Answers

2

Because, even if there is no full operating system involved, the file system in the Docker image looks like an extract of the root file system of a specific distro:

  • depending on "origin OS", to install additional packages in the Docker file, you will have to run yum, apt, or something else, and in case of apt you will use either the Debian or Ubuntu repos.
  • a few things (especially in /etc) aren't handled exactly the same across distributions (for instance, security certificates) so if you are familiar with Debian you'll be more at ease with a Debian/Ubuntu docker image than with a Centos one.
  • there are some less visible things that can come into play while being just as important, such as actual names and releases of specific packages. Some Docker images (Alpine?) don't even contain glib, which is the C runtime support for many Linux applications.

Otherwise, an "OS Docker image" is just a starting point for a more specialized image. For instance, if you need a web server, you start from an Debian image, use apt to install Apache and Tomcat, add your WARs. To debug your image you still have the whole range of utilities. When everything is stable you can remove the excess (typically doing a two-stage Dockerfile) and end up with a small image that contains just what is required for your server (Apache is just an example here, since you can find Apache images).

xenoid

Posted 2019-08-03T01:02:51.450

Reputation: 7 552

You're only addressing the file-system, package, and config aspects of the OS container. Whereas what I'm asking is: Relative to an LxC system container, why would you want to use a Docker OS container? – Harry – 2019-08-03T10:47:34.033

1No such thing as a "Docker OS container". The "OS" is only there for setup. In the final stages of the image creation, you can shed a lot of the initial OS. At the end you have an application container. Btw, Docker was based on LxC in the past. – xenoid – 2019-08-03T11:08:05.583

If you can shed a lot of the initial stuff from, say, the Ubuntu OS to create the ubuntu docker image, what would you use it for? Just for getting a bash shell? If it's an app container and not an OS container, why call it ubuntu instead of whatever app it's supposed to be for? And this app, btw, is ... ??? – Harry – 2019-08-03T14:36:32.587

1If you need a web server, you start from an Debian image, use apt to install apache and tomcat, add your WARs. To debug your image you still have the whole range of utilities. When everything is stable you can remove the excess (typically doing a two-stage Dockerfile) and end up with a small image that contains just what is required for your server. Apache is just an example here, since you can find Apache images. You can also build FROM scratch but is is a lot harder. – xenoid – 2019-08-03T18:26:03.803

Yes, this is what wasn't clear earlier. – Harry – 2019-08-04T00:48:11.350

0

@DanielB and @xenoid, if either of you wish to post your last comment as an answer, I could make it final. Unfortunately, I can make only one of the answers the final answer should both happen to be equally good.

Harry

Posted 2019-08-03T01:02:51.450

Reputation: 647