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 http://archive.raspbian.org/raspbian

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 resin.io base-images.

You may also like
ha-bridge in Docker container on a Raspberry Pi
RPi-Monitor Docker container
5 Comments
  • 2019-05-14T07:42:32+00:000000003231201905 at 07:42
    Reply

    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.?

  • 2019-05-06T12:43:33+00:000000003331201905 at 12:43
    Reply

    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.

  • 2019-04-25T06:16:47+00:000000004730201904 at 06:16
    Reply

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

  • 2019-04-09T06:19:10+00:000000001030201904 at 06:19
    Reply

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

  • Venkat Rao
    2018-04-19T12:33:44+00:000000004430201804 at 12:33
    Reply

    possible typo(–) in this statement:
    debootstrap –-variant=minbase –arch=armhf stretch raspbian-stretch http://archive.raspbian.org/raspbian

Leave Your Comment

Your Comment*

Your Name*
Your Webpage