dlrootfs
dlrootfs copied to clipboard
Download docker images from the docker hub to use them with other containers engine
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:
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
- Browse the docker hub and find the image you want (say ubuntu)
- Download ubuntu rootfs:
dlrootfs ubuntu
-
cd
torootfs
and create acontainer.json
file (needed bylibcontainer
, you can use the sample config of this repositorysample_configs/container.json
). - Launch bash in the official Docker ubuntu image:
nsinit exec /bin/bash
Using docker images with LXC
- Browse the docker hub and find the image you want (say ubuntu)
- Download ubuntu rootfs:
dlrootfs ubuntu
- Create a
config
file (for examples the one you can find insample_configs/lxc-config
) - Do not forget to change the
config
to match your settings (especially rootfs location) - 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 fornsinit
License
MIT