Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Dockerized" apps frequently are built on top of OS containers. Why doesn't this defeat the purpose?

Tags:

docker

A question came up as I was giving a presentation on Docker to my team that I didn't know how to answer.

Many of the prebuilt containers on Docker Hub, for just one example the jboss/wildfly container, are built on top of containers for a specific OS (Ubuntu, CentOS, etc.). A few of these containers ARE in fact nothing but containers for these OSes.

Yet Docker's main raison d'etre, it's prime claim to fame, the basis of its claim that it is better than Virtual Machine technologies, is that it is lighter weight because it doesn't need to be built on top of an OS. But if this is so and most containers include an OS does this not defeat the purpose and invalidate the claim?

So what IS in these OS Docker images, and how is the claim of lighter weight still able to be made? Is it some stripped down version of an OS?

Can one make a Docker image that is not built on top of an OS? What determines when an application gets OS services from the OS embedded in the container, as opposed to getting OS services from the host?

like image 337
Steve Cohen Avatar asked Jun 09 '15 20:06

Steve Cohen


People also ask

What is a dockerizing container?

What Is a Dockerizing. Dockerizing is the process of packing, deploying, and running applications using Docker containers. Docker is an open source tool that ships your application with all the necessary functionalities as one package. Where Docker containers are stored?

How to make a docker image smaller than 5MB?

For example, you can compile your Go program and package it on top of scratch to make a fully usable image that is less than 5MB. The key is to not use the official Docker images, they are too big.

How to get rid of layers in Docker?

Docker Squash is a really nice solution to this. you can $packagemanager clean in the last step instead of in every line and then just run a docker squash to get rid of all of the layers. Show activity on this post. Yes the layer system is quite surprising.

Can I have multiple from statements inside a dockerfile?

With Docker v17.06 there comes a new features for Dockerfiles: You can have multiple FROM statements inside one Dockerfile and only the stuff from last FROM will be in your final Docker image. This is useful to reduce image size, for example:


1 Answers

A Docker image (which will most likely contain the base system from a Linux distribution), is read only and is augmented with several layers that are enabled as you write to a location. So you can share the base image and have "add-ons" if you will. This is called a union file system. The docker documentation provides more information here. This kind of sharing makes Docker consume less resources (fs space in this case) compared to VMs, where you'd have to install a new distribution on each.

Note that you don't have to have a full Ubuntu installation (the kernel is shared with the host system, anyway), it is just that most of it is usually required by the applications you want to run in your container. You can easily find images that are stripped down, omitting files not needed to run most applications while still being viable for many targets (so you can still share the base image, see above).

like image 144
mabi Avatar answered Nov 01 '22 04:11

mabi