update readme

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 450b9218b9
commit 9319fec6f8

View File

@ -1,30 +1,37 @@
Undocker Undocker
-------- --------
Convert a Docker image to a root file system. Converts a Docker image (a bunch of layers) to a flattened "rootfs" tarball.
Why? Why?
--- ----
Docker images seems to be the lingua franca of distributing application Docker images seems to be the lingua franca of distributing application
containers. It's hell convenient. But is it the best runtime environment? Not containers. These are very wide-spread. However, is Docker the best runtime
for everyone. environment? Not for everyone.
Undocker bridges the gap between image configurations and container runtimes: Undocker bridges the gap between application images (in docker image format)
now you can run a Docker image with systemd-nspawn and/or lxc. and container runtimes: now you can run a Docker image with systemd-nspawn
and/or lxc, without doing the `docker pull; docker start; docker export` dance.
Usage -- extract docker image Usage -- extract docker image
----------------------------- -----------------------------
Download `nginx` docker image from docker hub and convert it to a rootfs: Download `nginx` docker image from docker hub and convert it to a rootfs:
``` ```
skopeo copy docker://docker.io/nginx:latest docker-archive:nginx.tar skopeo copy docker://docker.io/nginx:latest docker-archive:nginx.tar
undocker rootfs nginx.tar - | tar -xv undocker rootfs nginx.tar - | tar -xv
``` ```
(the same can be done with `docker pull` and `docker save`)
Usage -- systemd-nspawn example Usage -- systemd-nspawn example
------------------------------- -------------------------------
Once the image is converted to a root file-system, it can be started using
classic utilities which expect a rootfs:
``` ```
systemd-nspawn -D $PWD nginx -g 'daemon off;' systemd-nspawn -D $PWD nginx -g 'daemon off;'
``` ```
@ -32,7 +39,7 @@ systemd-nspawn -D $PWD nginx -g 'daemon off;'
Usage -- lxc example Usage -- lxc example
-------------------- --------------------
Converting and creating the archive: Preparing the image for use with lxc:
``` ```
undocker rootfs nginx.tar - | xz -T0 > nginx.tar.xz undocker rootfs nginx.tar - | xz -T0 > nginx.tar.xz
@ -40,7 +47,7 @@ undocker lxcconfig nginx.tar config
tar -cJf meta.tar.xz config tar -cJf meta.tar.xz config
``` ```
Importing it to lxc and running it: Import it to lxc and run it:
``` ```
lxc-create -n bb -t local -- -m meta.tar.xz -f nginx.tar.xz lxc-create -n bb -t local -- -m meta.tar.xz -f nginx.tar.xz
@ -51,13 +58,17 @@ lxc-start -F -n bb -s lxc.net.0.type=none -- /docker-entrypoint.sh nginx -g "dae
Note: automatic entrypoint does not work well with parameters with spaces; not Note: automatic entrypoint does not work well with parameters with spaces; not
sure what lxc expects here to make it work. sure what lxc expects here to make it work.
About the implementation
------------------------
Extracting docker image layers may be harder than you have thought. See
`rootfs/doc.go` for more details.
The rootfs code is dependency-free (it uses Go's stdlib alone). The existing
project dependencies are convenience-only.
Contributions Contributions
------------- -------------
These are the contributions I will accept: I will accept pull request for code (including tests) and documentation. I am
unlikely to react to bug reports without a patch.
- pull requests for code.
- documentation updates.
I am very unlikely to react to bug reports (even if they are legit) without
accopmanying pull requests.