Docker Community Forums

Share and learn in the Docker community.

Virtual monitor in docker?

(Oscar) #1

In vagrant/virtualbox, I can make a virtual monitor like:
vb.customize [ "modifyvm", :id, "--monitorcount", 1].

Is it possible to implement same thing in docker ?

(Jeff Anderson) #2

Docker is not a virtualization solution and does not virtualize any hardware. Virtualbox is a virtualization solution, so the virtual monitor feature you speak of is faking video/monitor hardware to the OS running in the VM.

Docker is a fancy way to run processes. There is no separate kernel, no bios, no OS. It’s just a process that your already-running kernel is isolating using cgroups, namespaces, and chroot.

Now, there are ways to get an in-memory framebuffer. xvfb is one example for creating a framebuffer. It isn’t backed by any hardware and you can run it on any linux host. Whether it is a virtualized Linux, or a bare metal Linux, you can run xvfb. You could also fire up an xvfb instance inside a docker container too.

Hopefully this helps!


(Oscar) #3

Isn’t container built on top of some sort of OS?

We could have 2 containers: 1 is ubuntu-based and another is centos-based, for example…

We create a container using Dockerfile, where we explicitly specify which distro to use using FROM.

(Jeff Anderson) #4

So, a container is a way to run a process. That process will get a virtual / since it expects to be able to see files. Pretty much anything can go into this virtual /. For convenience, it is common to use ubuntu or centos based images to populate the / for a container.

As a counterexample to using full distro-based images with a container, I created this example a while back:

Basically, it shows how to create an image that contains one single statically compiled binary. Nothing else exists in the image at all. Since a container is just about a process, and the statically compiled binary doesn’t need anything else to run, this works very well.

Since a container is just a way to run a process, rephrasing the question to use the word “process” instead of “container” sometimes helps put things into perspective.


(Oscar) #5

Thanks again.
But concept of a distro in the service is important as an app is created for some specific distro.

(Jeff Anderson) #6

This is definitely true, but having a / that looks like the root filesystem of a distro doesn’t also mean that a container is some sort of virtualization-- it’s just a way to isolate a process on the host system.