All Projects → robinmonjo → dlrootfs

robinmonjo / dlrootfs

Licence: other
Download docker images from the docker hub to use them with other containers engine

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects
Makefile
30231 projects

dlrootfs is now cargo

cargo include dlrootfs features and brings the possibility to push on the docker hub

dlrootfs (deprecated see cargo)

Download root file systems from the docker hub without docker

Usage: dlrootfs <image_name>:[<image_tag>] [-d <rootfs_destination>] [-u <username>:<password>] [-g]

Examples:
  dlrootfs ubuntu  #if no tag, use latest
  dlrootfs ubuntu:precise -d ubuntu_rootfs
  dlrootfs dockefile/elasticsearch:latest
  dlrootfs my_repo/my_image:latest -u username:password
  dlrootfs version
Default:
  -d="./rootfs": destination of the resulting rootfs directory
  -g=false: use git layering
  -u="": docker hub credentials: <username>:<password>

-g flag

As explained in the doc, docker images are a set of layers. Using the -g flag, dlrootfs will download the file system in a git repository where each layer is downloaded in a separate branch:

Alt text

The screenshot above is the resulting rootfs of dlrootfs ubuntu -g. We can clearly see the image is composed of 5 layers. layer(n)_* results from git checkout -b layer(n-1)_* with data from layer(n).

It allows to use git to see diffs between layers, checkout a new branch, work on the rootfs with a container engine, review and commit changes, etc. It also opens the path for docker push without docker (coming soon).

Installation

curl -sL https://github.com/robinmonjo/dlrootfs/releases/download/v1.4.0/dlrootfs_x86_64.tgz | tar -C /usr/local/bin -zxf -

Provided binary is linux only but dlrootfs may be used on OSX and (probably) windows too. The difference is, when ran on a linux box, dlrootfs will perform lchown during layer extraction, it won't otherwise.

Some images require you to be root during extraction (the official busybox image for example) why others won't (the official debian one).

Why dlrootfs ?

Docker has become really popular and lots of people and organisations are building docker images they store and share on the docker hub. However these images are only available for docker's user. dlrootfs allows to download root file systems from the docker hub so they can be used with other container engines (LXC, nsinit (libcontainer), systemd-nspawn ...)

Using docker images with nsinit
  1. Browse the docker hub and find the image you want (say ubuntu)
  2. Download ubuntu rootfs: dlrootfs ubuntu
  3. cd to rootfs and create a container.json file (needed by libcontainer, you can use the sample config of this repository sample_configs/container.json).
  4. Launch bash in the official Docker ubuntu image: nsinit exec /bin/bash
Using docker images with LXC
  1. Browse the docker hub and find the image you want (say ubuntu)
  2. Download ubuntu rootfs: dlrootfs ubuntu
  3. Create a config file (for examples the one you can find in sample_configs/lxc-config)
  4. Do not forget to change the config to match your settings (especially rootfs location)
  5. Launch bash in the "official Docker ubuntu image LXC container": lxc-start -n ubuntu -f <config file> /bin/bash

Warnings

  • Untaring on the vagrant shared folder will fail
  • cgroup-lite is required for nsinit

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].