update README
This commit is contained in:
parent
a688450fb8
commit
10e675d289
66
README.md
66
README.md
@ -6,13 +6,13 @@ 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 became a popular way to distribute applications with their
|
||||||
containers. These are very wide-spread. However, is Docker the best runtime
|
dependencies. However, Docker itself is not the best runtime environment. At
|
||||||
environment? Not for everyone.
|
least not for everyone.
|
||||||
|
|
||||||
Undocker bridges the gap between application images (in docker image format)
|
Undocker bridges the gap between application images (in docker image format)
|
||||||
and container runtimes: now you can run a Docker image with systemd-nspawn
|
and container runtimes: now you can run a Docker image with old-fashioned
|
||||||
and/or lxc, without doing the `docker pull; docker start; docker export` dance.
|
tools: lxc, systemd-nspawn or systemd itself.
|
||||||
|
|
||||||
Usage -- extract docker image
|
Usage -- extract docker image
|
||||||
-----------------------------
|
-----------------------------
|
||||||
@ -20,55 +20,49 @@ 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/busybox:latest docker-archive:busybox.tar
|
||||||
undocker rootfs nginx.tar - | tar -xv
|
undocker rootfs busybox.tar - | tar -xv
|
||||||
```
|
```
|
||||||
|
|
||||||
(the same can be done with `docker pull` and `docker save`)
|
Almost the same can be done with a combination of `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
|
Start with systemd-nspawn:
|
||||||
classic utilities which expect a rootfs:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
systemd-nspawn -D $PWD nginx -g 'daemon off;'
|
systemd-nspawn -D $PWD busybox httpd -vfp 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
Usage -- lxc example
|
Usage -- plain old systemd
|
||||||
--------------------
|
--------------------------
|
||||||
|
|
||||||
Preparing the image for use with lxc:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
undocker rootfs nginx.tar - | xz -T0 > nginx.tar.xz
|
systemd-run \
|
||||||
undocker lxcconfig nginx.tar config
|
--wait --pty --collect --service-type=exec \
|
||||||
tar -cJf meta.tar.xz config
|
-p PrivateUsers=true \
|
||||||
|
-p DynamicUser=yes \
|
||||||
|
-p ProtectProc=invisible \
|
||||||
|
-p RootDirectory=$PWD \
|
||||||
|
-- busybox httpd -vfp 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
Import it to lxc and run it:
|
Good things like `PrivateUsers`, `DynamicUser`, `ProtectProc` and other
|
||||||
|
[systemd protections][1] are available, just like to any systemd unit.
|
||||||
|
|
||||||
```
|
Notes & gotchas
|
||||||
lxc-create -n bb -t local -- -m meta.tar.xz -f nginx.tar.xz
|
---------------
|
||||||
lxc-start -F -n bb -s lxc.net.0.type=none
|
|
||||||
lxc-start -F -n bb -s lxc.net.0.type=none -- /docker-entrypoint.sh nginx -g "daemon off;"
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: automatic entrypoint does not work well with parameters with spaces; not
|
`unocker` does not magically enable you to run containers from the internet. In
|
||||||
sure what lxc expects here to make it work.
|
fact, many will need significant tuning or not work at all. Thus you will still
|
||||||
|
need to understand what are you running.
|
||||||
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
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
I will accept pull request for code (including tests) and documentation. I am
|
I will accept pull request for code (including tests) and documentation. I am
|
||||||
unlikely to react to bug reports without a patch.
|
unlikely to react to issue reports without a patch.
|
||||||
|
|
||||||
|
[1]: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
||||||
|
Loading…
Reference in New Issue
Block a user