OS in a Container?

Hello all,

Sorry but this has been bothering me and I wanted some clarification.

I have been trying to set a MQTT broker up (mosquitto) within a docker container but without the overhead of an OS (for example Ubuntu or Debian). However everywhere I look everyone is putting the an OS into the container then installing mosquitto. This is counter intuitive if you already have a OS that you run the Docker container from and just adds extra process for no reason.

Is there a way of doing this for an MQTT broker, as I have a few other of my programs that I run in a container on there own and ideally need the broker to be a single purpose container with non of the overheads an OS has.

Many Thanks,

James

Hi,

First of all, Its not that we put OS into the container. Every container in docker run from a base Docker image which is a minimalistic filesystem snapshot of different or same OS. And these images or running containers doesnt bring their own kernel but uses the Host OS Kernel. Also once these containers are run, its not a a full blown machine with an OS that is running. Its just the program that you execute inside the container that runs.

I think you are looking at something like chroot, but docker is more than that.

Regards

1 Like

Hi,

Thank you for the response, what you are saying makes a lot of sense and I believe I got the wrong end of the stick.
However I have inspected the basic Ubuntu image and there is so much bloat that is not needed it still seems pointless to store what seems a Ubuntu system minus the Kernel.

Cheers

James

Hi,

Ubuntu base image that you inspected I hope is the official one. They might have build it as a general purpose image which satisfies most of the requirements.

In case the bloat or size of the image matters you can consider using various other base images which are much smaller in size removing most of the bloats.

Alpine Linux( http://www.alpinelinux.org/ ) is a good candidate for you to consider I believe. Its just 5.24 MB.

$docker images alpine
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
alpine              latest              31f630c65071        3 months ago        5.254 MB
alpine              edge                5e704a9ae9ac        3 months ago        5.31 MB

Regards

Hi,

I have started using buildroot and can make an image with what I need for as per example above a MQTT broker in under 7MB.

Thank you for your help and knowledge it a appreciated greatly.

James

Hi,

Thats great. I haven’t tried yet to build a base image. I should also try to build a stripped down baseimage.

Thanks for the info

Regards