[Top][All Lists]

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

Re: Creating a docker image with Guix

From: Christopher Allan Webber
Subject: Re: Creating a docker image with Guix
Date: Mon, 02 Jan 2017 20:28:57 -0600
User-agent: mu4e 0.9.16; emacs 25.1.1

Ricardo Wurmus writes:

> 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

I won't comment on the specific application, but I think it's a good
thing to have.  I was watching the conversation about providing an Emacs
Docker image on emacs-devel, and despite my caveats about Docker, I
think having Guix be a good way to get a "reproducible" image here is a
good idea.  If nothing else, maybe it could become a good reason for
Docker-using people to explore Guix...

Thanks for exploring this, Ricardo!
 - Chris

reply via email to

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