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
1 Comment
  • Venkat Rao
    2018-04-19T12:33:44+00:000000004430201804 at 12:33

    possible typo(–) in this statement:
    debootstrap –-variant=minbase –arch=armhf stretch raspbian-stretch

Leave Your Comment

Your Comment*

Your Name*
Your Webpage