Docker Community Forums

Share and learn in the Docker community.

Why do we need Ubuntu image?


(Adityachilakamarthy) #1

Hi All,
I’m new to docker and still learning through documentation. When I saw the documentation, I see “Ubuntu” image being pulled from Hub. I know that the docker directly runs on the Host OS and doesn’t need a guest OS.

If that is the case why are we downloading Ubuntu image again?
Can we not ‘run’ a container by directly installing the application that we want to use?
Please explain.

Aditya


(Ranjandas) #2

Hi Aditya,

The docker containers filesystem is isolated from the host OS. So an application packaged inside a docker image wont be able to see the host filesystem(unless attached as volume) at the time of running as a container. So, imagine the application you have inside the container depends on various OS libraries, so maintaining the isolation if we want to run the application we will have to package those dependencies too inside the Docker Image. This is why there are base images available for various Linux distros. Also having a distro will give us its package management features like yum/apt-get so that we can design the docker image with required dependencies in much easier way. And the ubuntu image you are referring is not a full blown one, its a stripped down version of Ubuntu even though its not the smallest docker image available. Also these docker images doesn’t come with a kernel, at runtime, it uses the host kernel.

Now there is a different scenario where you can run your application inside an empty container. There is a special docker image named scratch available using which you can build your docker image.But in the case the application should be a static binary which comes with all the dependencies built into the binary.

You can read more about scratch container here : http://blog.xebia.com/create-the-smallest-possible-docker-container/

Regards


(Crashr) #3

So is it possible to run an ubuntu docker container on a debian (or other linux) host ?


(Shahzadfatehali) #4

If we need Ubuntu or any other OS then how Docker is different from vagrant or running any other VM over Virtual Box, as far as the development environments are concern?