Docker Linux

Creating a Raspbian Docker base-image

During some testing with docker, I wanted to create my own base image rather than using pre-build images. I did that to get a better understanding of the technology behind docker.

First, we need to install debootstrap – a tool for installing a Debian-based Linux distribution into a specified directory on an existing and running operating system.

apt-get update
apt-get install debootstrap

The following command will call debootstrap and install Raspbian Stretch (minimal image) into the directory “raspbian-stretch” in the current working directory:

debootstrap –-variant=minbase --arch=armhf stretch raspbian-stretch

Finally, we need to convert the directory into a docker base image using:

tar -C raspbian-stretch -c . | docker import - raspbian-stretch

From that point on you can build your docker images with your own base image by specifying the image in the DOCKERFILE using “FROM raspbian-stretch”.

Using a fully-blown operating system as a docker base image is not a good idea. Docker is intended to use as small as possible containers and base-images. For most of my ‘production’ containers I’m using the base-images.

You may also like
RPi-Monitor Docker container
ha-bridge in Docker container on a Raspberry Pi

Leave Your Comment

Your Comment*

Your Name*
Your Webpage