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
  • November 16, 2019 at 01:32

    Thank you a bunch for sharing this with all
    people you really recognize what you are talking about!

  • May 14, 2019 at 07:42

    use Debian testing. It is easy to test using live cd, pretty easy to install, and usage is just a breaze. Steam, Wine, native games, lutris, all work easily, just like on any other distro. You can install one of 20 different desktop environments on Debian, so you can do whatever you want. The minimal version of Debian uses about 60MB of RAM. It is lighter than xubuntu.

    If somebody asks what distro to use, they simply do not know, or are begginers. In such case, Ubuntu 18.10, or Xubuntu, plus installed MATE, (or their desktop of choice) on top of standard ubuntu, are the best bet. Better compatibility, easy updates, more support online, etc. I hate Ubuntu, but that is the truth, and I would recommend Ubuntu before anything to beginers. If there are some issues, it is very unlikely switching to some other distro will magically solve the problem.?

  • May 6, 2019 at 12:43

    Yeah, I know how these things aren’t exploding in popularity, they’re literally the best thing for the average consumer.
    Retro gamers won’t need a beefy computer to do everything they need. Or a computer to begin with, just access to one for like 10 minutes.
    Schools won’t need to waste thousands of dollars by equipping their media rooms with shit overpriced computers.
    Tech illiterate older people won’t get flabergastered by a complete OS with too many things to worry about.
    Non Tech intensive people won’t be wasting 500-700 bucks on a full fledged laptop to write their documents, do their excels or browse facebook.
    These things are a godlike media center.
    You can set one up with cheap parts under 100 bucks excluding monitor, which if you have a smaller, less used TV, then you don’t need one.
    They’re portable.
    They’re highly customizable with the extra add-on sticks.

  • April 25, 2019 at 06:16

    I know this web page provides quality dependent content and other stuff,
    is there any other web page which offers these stuff in quality?

  • April 9, 2019 at 06:19

    Greetings! Very useful advice in this particular article!
    It is the little changes that make the largest changes.
    Thanks for sharing!

  • Venkat Rao
    April 19, 2018 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