Git Product home page Git Product logo

baci's Introduction

Baci - Build an ACI.

Build Status

Baci is an ACI builder. See the App Container Specification.

How is it implemented?

The build process is done inside the container (it's an ACI that builds other ACIs!).

I'm not already sure if this was a good choice but it was the easiest. Maybe in the future this can move from being an ACI to become an extension to the rocket stage1 or just an external program that uses rkt (this will need rocket to implement some additional features).

By now some issues to deal with are known and other can arise:

  • There's the need to deal with the other filesystems mounted by the ACE (now and in the future) like /dev, /proc, /sys etc...
  • The base image needs to be extracted by the baci's ACI.

Why are you using a Dockerfile?

This isn't a replacement for docker build and I'm pretty sure that trying to create an ACI using a Dockerfile that's 100% identical to the images created by docker is probably impossible.

I started with the Dockerfile build language as I needed something ready to test. By now base images (FROM) are downloaded and converted using docker2aci (or better, the rocket's cas, which uses docker2aci, is used to get them). In future also other (non docker converted) ACIs should be used as base images.

What about other build languages?

I think that a build language like a Dockerfile is fundamental to create containers in an easy and (semi)reproducible way.

By now, just for the reasons explained above an initial DockerBuilder has been developed.

I'm hoping that a standard container build language will be defined/created (peraphs something with a better separation between the build directives and the container definition, like exec program, volumes etc...).

Build

As Baci uses rocket to execute the build process, you'll need Rocket.

$ git clone https://github.com/sgotti/baci
$ cd baci
$ ./build

All the needed files are created inside ./bin

Note: the build scripts tries to get a local copy of xz and the needed libraries (it's needed to extract tar.xz files). If xz is not found then a warning is reported. This is tested on a fedora system (to install xz use {yum|dnf} install xz).

Examples

Base fedora image

$ git clone https://github.com/fedora-cloud/docker-brew-fedora

$ cd docker-brew-fedora

Right now baci needs to be run as root.

$ $BACIBIN/baci --rktpath $RKTBIN/rkt -o $OUTDIR/fedora.aci -n "example.com/fedora:21,os=linux,arch=amd64" .

where:

  • --rktpath is the path to the rkt executable
  • -o or --outfile is the output ACI filename
  • -n or --name is ACI name (and optional labels) in the same format used by rocket. For example: example.com/postgres:9.3.6,os=linux,arch=amd64

If everything goes ok you'll find your aci in $OUTDIR/fedora.aci and you can run it with $RKTBIN/rkt run $OUTDIR/fedora.aci (as the exec cmd is /bin/bash, now it will just exit)

Something more complex: fedora based postgresql

$ git clone https://github/docker-library/fedora-cloud

$ $BACIBIN/baci --rktpath $RKTBIN/rkt -o $OUTDIR/postgre.aci -n "example.com/postgres:9.3.6,os=linux,arch=amd64` ./fedora-cloud/Fedora-Dockerfiles/postgres/

When finished:

$ $RKTBIN/rkt run $OUTDIR/postgre.aci

Access your rocketized postgresql.

TODO

  • Make this todos github's issues...
  • Use acirenderer to render ACIs with dependencies.
  • Use acibuilder's diff builder to create only ACIs with differences from the base image.

baci's People

Contributors

sgotti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

baci's Issues

It's not workable with appc v0.52 and rkt v0.5.6 any more

It's NOT compatible with the latest appc and rkt any more !

Firstly, rkt and appc now require signature for all images, even for local ones. Directly run baci would always got error "error opening signature file: open /usr/local/bin/baci.aci.asc".

$ sudo baci --rktpath /usr/local/bin/rkt -o $(pwd)/fedora.aci -n "linfan/fedora:21,os=linux,arch=amd64" .
2015/05/30 15:05:26 baseImage: scratch
error opening signature file: open /usr/local/bin/baci.aci.asc: no such file or directory
2015/05/30 15:05:28 Builder container exited with error: exit status 1

So I made it to create a self-signed signature file for baci.aci, but when processing both of the example Dockerfile, another error pop up: "error extracting tar: error extracting tarball: chmod /sys: read-only file system".

$ sudo baci --rktpath /usr/local/bin/rkt -o $(pwd)/fedora.aci -n "linfan/fedora:21,os=linux,arch=amd64" .
2015/05/30 15:00:29 baseImage: scratch
rkt: signature verified:
  Lin Fan (ACI signing key) <[email protected]>
/etc/localtime is not a symlink, not updating container timezone.
2015/05/30 15:00:32 Starting the baci aci!
2015/05/30 15:00:32 Extracting fedora-22-release.tar.xz in /
error: error execting Dockerfile command "ADD fedora-22-release.tar.xz /": error extracting source file fedora-22-release.tar.xz: error extracting tar: error extracting tarball: chmod /sys: read-only file system
Sending SIGTERM to remaining processes...
Sending SIGKILL to remaining processes...
Unmounting file systems.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/pts.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/shm.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/sys.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/proc.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/console.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/tty.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/urandom.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/random.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/full.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/zero.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/dev/null.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/source.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/data.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/dest.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/source.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/data.
Unmounting /opt/stage2/sha512-8648372528e1b62e11a5a7fd62d74512/rootfs/baci/dest.
Unmounting /proc/sys/kernel/random/boot_id.
All filesystems unmounted.
Halting system.
2015/05/30 15:00:33 Builder container finished.

It looks like some part of this tool is totally out of date. Any plan to fix it?

Also want to point out, the repo and folder name in the second example already changed, it should be update as below.

$ git clone https://github.com/fedora-cloud/Fedora-Dockerfiles/
$ sudo baci --rktpath $RKTBIN/rkt -o $OUTDIR/postgre.aci -n "example.com/postgre:9.3.6,os=linux,arch=amd64" Fedora-Dockerfiles/postgresql

Question: running x11 apps

hi @sgotti,

I just came across baci/ App Container/rocket and have a question: with docker I used to run graphical apps like firefox.

e.g http://www.slideshare.net/dotCloud/dockerizing-your-appli

 docker run -e DISPLAY=unix$DISPLAY -volumes-from firefox-data -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/snd:/dev/snd -lxc-conf='lxc.cgroup.devices.allow = c 116:* rwm' firefox

e.g. https://registry.hub.docker.com/u/kennethkl/firefox/

docker run -d --name firefox -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix kennethkl/firefox

e.g. https://github.com/subuser-security/subuser

Do you know if something similar is possible with baci/ App Container/rocket.

Thanks
P

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.