5

I am new to docker and trying to understand the concept of base image.

Let's say I have a hello-world docker app on windows machine with ubuntu as base image in Dockerfile.

Now to run this hello-world application, Is docker going to install the whole ubuntu to run the application?

If not then how ubuntu base image will be used here and How will Docker container facilitate the commutation between ubuntu based application and windows OS?

Atul
  • 1,694
  • 4
  • 21
  • 30

1 Answers1

8

Now to run this hello-world application, Is docker going to install the whole ubuntu to run the application?

No, the ubuntu image used is not "the whole ubuntu". It is a trimed-down version, without the all X11 graphic layer. Still 180 MB though: see "Docker Base Image OS Size Comparison".

These days, you would rather use an Alpine image (5 MB): see "Docker Official Images are Moving to Alpine Linux"

Regarding the hello-world application specifically, there is no Ubuntu or Alpine involved. Just 1.8 KB of C machine-code, which makes only direct calls to the Linux kernel of the host.

That Linux host is used by docker container through system calls: see "What is meant by shared kernel in Docker?"

On Windows, said Linux host was provided by VirtualBox VM running a boot2docker VM, built from a TinyCore distro.

With the more recent "Docker for Windows", that same VM is run through the Hyper-V Windows feature.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Assume that there is a base image for MacOS. Can it run on Windows? Will docker create a new VM for MacOS through Hyper-V? – Jacob Phan Jul 28 '16 at 12:21
  • @JacobPhan There is no such thing as "a base image for MacOS": each base image is an image able to run on top of any Linux kernel. As long as your host (Mac or Windows) is able to provide a VM with a Linux in it (and its kernel, and a docker installed in it), that base image will run. – VonC Jul 28 '16 at 12:24
  • Is there also no such thing as "a base image for windows"? Is it possible to get an image with IIS, session state, MSMQ, sql server? – Jacob Phan Jul 29 '16 at 02:02
  • https://hub.docker.com/r/microsoft/iis/ This image bases on windowsservercore. Does windowsservercore base on ubuntu? – Jacob Phan Jul 29 '16 at 03:10
  • @JacobPhan No it is not: https://github.com/Microsoft/Virtualization-Documentation/blob/live/windows-container-samples/windowsservercore/iis/Dockerfile#L3 This is purely for Docker Engine for Windows Server, which requires Windows Server 2016 (see http://ezeeetm.github.io/Docker-Engine-for-Windows-Server-Walkthrough/). This differs from the traditional docker working on Linux (with Docker for windows or Docker for Mac being VMs allowing a Linux to run) – VonC Jul 29 '16 at 06:47