Bouw root filesystems met Buildroot en Docker

Auke Willem Oosterhoff

Wat is Docker?

Docker containers wrap up a piece of software in a complete filesystem that contains everything it needs to run: code, runtime, system tools, system libraries – anything you can install on a server. This guarantees that it will always run the same, regardless of the environment it is running in.

https://www.docker.com/whatisdocker

Image

FROM maxexcloo/java:latest
MAINTAINER Max Schaefer <max@excloo.com>

ENV EULA true
ENV MEMORY 1024
ENV VERSION 1.8.3

ADD config /config
ADD supervisord.conf /etc/supervisor/conf.d/minecraft.conf

EXPOSE 25565

Containers bevatten een root filesystem

Containers draaien op de kernel van de host

Wat is Buildroot?

Buildroot is a set of Makefiles and patches that makes it easy to generate a complete embedded Linux system. Buildroot can generate any or all of a cross-compilation toolchain, a root filesystem, a kernel image and a bootloader image.

http://buildroot.uclibc.org/about.html

Configuratie Buildroot

Docker image met Buildroot

FROM ubuntu:14.10
MAINTAINER Auke Willem Oosterhoff

RUN apt-get update && \
    apt-get install -y \
    build-essential \
    bash \
    bc \
    binutils \
    build-essential \
    bzip2 \
    cpio \
    g++ \
    gcc \
    git \
    gzip \
    libncurses5-dev \
    make \
    mercurial \
    patch \
    perl \
    python \
    rsync \
    sed \
    tar \
    unzip \
    wget

Docker image met Buildroot

...

WORKDIR /root
RUN git clone git://git.buildroot.net/buildroot 
WORKDIR /root/buildroot

CMD ["/bin/bash"]

Docker image met Buildroot

Containers zijn stateless

Data-only containers met volumes

Changes to a data volume are made directly.

Data volumes persist even if the container itself is deleted.

https://docs.docker.com/userguide/dockervolumes/

Data volumes persist even if the container itself is deleted.

Data-only containers met volumes

...

WORKDIR /root
RUN git clone git://git.buildroot.net/buildroot 
WORKDIR /root/buildroot


VOLUME /root/buildroot/dl
VOLUME /buildroot_output

CMD ["/bin/bash"]

Data blijft bewaard

Data van container naar host

Bouw root filesytem

Importeer root filesystem

https://github.com/OrangeTux/docker-buildroot

Links

https://blog.docker.com/2013/06/create-light-weight-         docker-containers-buildroot/

https://asciinema.org/~OrangeTux

http://buildroot.uclibc.org/downloads/manual/manual.html#requirement

https://slides.com/aukewillem/deck/

deck

By Auke Willem

deck

  • 581