all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Creating a docker image with Guix
@ 2017-01-02 12:54 Ricardo Wurmus
  2017-01-02 13:05 ` David Craven
                   ` (6 more replies)
  0 siblings, 7 replies; 22+ messages in thread
From: Ricardo Wurmus @ 2017-01-02 12:54 UTC (permalink / raw)
  To: guix-devel

Hi Guix,

I just played around with Docker and built up a command to create a
Docker image for Emacs.

Can anyone find a more elegant way to do this?

--8<---------------cut here---------------start------------->8---
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 -
--8<---------------cut here---------------end--------------->8---

What happens here is this:

* using “guix environment” build a temporary profile containing
  coreutils (for “ln”), bash (for “sh”), and emacs

* inside the environment $GUIX_ENVIRONMENT points to the profile; take
  all of the requisites for this profile (“guix gc --requisites”) and
  send them to “docker import” using a tar pipe

* modify the base image such that it links the profile’s “bin” directory
  to “/bin” when a derivative image is built

* name that base image “emacs-base”

* then build a derivative of this base image with “docker build” (this
  causes “ln -s” to be executed) and make it run the command
  “/bin/emacs” by default

The result is an unnamed image (“docker build” reports an image id such
as “ae8d6281b56f”) that can be run interactively like this:

    docker run -it --rm ae8d6281b56f

What do you think?  Gross?

~~ Ricardo

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-01-08 11:00 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.