[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a docker image with Guix

From: Ricardo Wurmus
Subject: Re: Creating a docker image with Guix
Date: Tue, 3 Jan 2017 11:45:59 +0100
User-agent: mu4e 0.9.16; emacs 25.1.1

Ludovic Courtès <address@hidden> writes:

> Ricardo Wurmus <address@hidden> skribis:
>> I just played around with Docker and built up a command to create a
>> Docker image for Emacs.
> Fun!
>> Can anyone find a more elegant way to do this?
>> guix environment --ad-hoc \
>>     coreutils bash emacs-no-x-toolkit -- \
>>     sh -c 'tar -c $(guix gc --requisites $GUIX_ENVIRONMENT) | \
>>            docker import -c "ONBUILD RUN [\"$GUIX_ENVIRONMENT/bin/ln\", 
>> \"-s\", \"$GUIX_ENVIRONMENT/bin\", \"/bin\"]" - emacs-base' \
>>            && echo -e "FROM emacs-base\nCMD [\"/bin/emacs\"]" | \
>>            docker build -
> What does the resulting image look like?

It’s very hard to tell because this command doesn’t spit out a file that
fully represents the image.  Instead it modifies some state in

> Would it be enough to generate an “Image JSON Description” in this
> format: <>?

No.  On Fedora (where I ran the above command) Docker uses the
devicemapper backend.  “docker build” appears to have created an XFS
file system in a file.  Different installations use different backends
(e.g. direct-lvm or aufs) — this probably means that we should not try
to build an image for a particular backend directly.

However, there is a “docker save” command to export an image as a tar
archive (which can be imported by a docker instance), and the format of
the resulting archive looks pretty simple:  It contains a couple of JSON
files and two “layer.tar” archives.  The first contains the files of the
base image (i.e. all the /gnu/store stuff), the second contains the
added symlink from “/bin” to “/gnu/store/.../bin” (and “/run/secrets”).

> I’m not familiar enough with Docker but I’m under the impression that we
> should be able to generate an image without even using Docker.  :-)

Absolutely!  Now that I know about “docker save” I’ll give it another


reply via email to

[Prev in Thread] Current Thread [Next in Thread]