From: ludo@gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH] Creating a docker image with Guix
Date: Wed, 04 Jan 2017 22:59:01 +0100 [thread overview]
Message-ID: <87d1g2h4gq.fsf@gnu.org> (raw)
In-Reply-To: <idj4m1gw41i.fsf@bimsb-sys02.mdc-berlin.net> (Ricardo Wurmus's message of "Tue, 3 Jan 2017 16:34:33 +0100")
Howdy!
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:
> Ludovic Courtès <ludo@gnu.org> writes:
>
>> 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. :-)
>
> The attached patch adds a Docker export feature, so you can do this:
>
> docker load < \
> $(guix archive --export-docker-image=$(readlink -f ~/.guix-profile))
Woow, that was fast!
> Then you can use “docker images” to show the available images. For some
> reason Docker won’t show the name and tag “guix archive” generates, so
> just take the most recently added image. Then run it, e.g. like this:
>
> docker run --rm -ti d11111472905 /bin/emacs
>
> This starts the container and runs “/bin/emacs” interactively. During
> export “guix archive” also links the item’s “./bin” directory to “/bin”,
> so users can run commands without having to know the long store path.
Awesome!
> I used it successfully to build an Emacs Docker image like this:
>
> guix environment --ad-hoc coreutils bash emacs-no-x-toolkit
> docker load < $(guix archive --export-docker-image=$GUIX_ENVIRONMENT)
Be sure to let emacs-devel know. ;-)
> From d600db91078f28d82324671e3d43acaddc9b9608 Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Tue, 3 Jan 2017 16:20:15 +0100
> Subject: [PATCH] guix: Add Docker image export.
>
> * guix/docker.scm: New file.
> * Makefile.am (MODULES): Register it.
> * guix/scripts/archive.scm (show-help, %options, guix-archive): Add
> support for "--export-docker-image".
> * doc/guix.texi (Invoking guix archive): Document it.
Looks great!
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -2438,6 +2438,12 @@ Read a list of store file names from the standard input, one per line,
> and write on the standard output the subset of these files missing from
> the store.
>
> +@item --export-docker-image=@var{directory}
> +@cindex docker, export
> +Recursively export the specified store directory as a Docker image in
> +tar archive format. The generated archive can be loaded by Docker using
> +@command{docker load}.
Maybe “as a Docker image in tar archive format, as specified in
@uref{http://…, version 1.0 of the Foo Bar Spec}.”
I would be in favor of --format=FMT, where FMT can be one of “nar” or
“docker”. Maybe there’ll be others in the future. WDYT?
The paragraph that says “Archives are stored in the “normalized archive”
or “nar” format,“ should be updated.
Also, it seems that ‘-f docker’ would always imply ’-r’, right? That’s
reasonable but would be worth mentioning.
> +(define (hexencode bv)
> + "Return the hexadecimal representation of the bytevector BV."
> + (format #f "~{~2,'0x~}" (bytevector->u8-list bv)))
Maybe use ‘bytevector->base16-string’ from (guix utils) instead.
> +(define spec-version "1.0")
Please add the URL to said spec as a comment.
> +;; TODO: heroically copied from guix/script/pull.scm
> +(define (temporary-directory)
Alternatively, there’s ‘call-with-temporary-directory’ in (guix utils).
:-)
> + (and (zero? (apply system* "tar" "-cf" "layer.tar"
> + (cons "../bin" items)))
> + (delete-file "../bin"))))
This reminds me we should steal this code of Mark’s sometime:
https://github.com/spk121/guile100/blob/master/code/tar2.scm
Thank you!
Ludo’.
next prev parent reply other threads:[~2017-01-04 21:59 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-02 12:54 Creating a docker image with Guix Ricardo Wurmus
2017-01-02 13:05 ` David Craven
2017-01-02 14:06 ` Hartmut Goebel
2017-01-02 15:04 ` Pjotr Prins
2017-01-02 15:22 ` Ricardo Wurmus
2017-01-02 15:37 ` John Darrington
2017-01-02 22:19 ` Ludovic Courtès
2017-01-03 10:45 ` Ricardo Wurmus
2017-01-03 15:34 ` [PATCH] " Ricardo Wurmus
2017-01-03 16:24 ` Chris Marusich
2017-01-03 16:45 ` Ricardo Wurmus
2017-01-04 22:12 ` Ludovic Courtès
2017-01-04 21:59 ` Ludovic Courtès [this message]
2017-01-05 16:13 ` Ricardo Wurmus
2017-01-05 20:09 ` Thompson, David
2017-01-05 23:19 ` Ludovic Courtès
2017-01-06 23:58 ` [PATCH] guix archive: '-f docker' supports package names as arguments Ludovic Courtès
2017-01-07 7:07 ` Ricardo Wurmus
2017-01-08 11:00 ` Ludovic Courtès
2017-01-03 2:28 ` Creating a docker image with Guix Christopher Allan Webber
2017-01-03 6:31 ` Jan Nieuwenhuizen
2017-01-03 12:38 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1g2h4gq.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=ricardo.wurmus@mdc-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).