From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Creating a docker image with Guix Date: Mon, 2 Jan 2017 13:54:30 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cO28T-0005pu-Ir for guix-devel@gnu.org; Mon, 02 Jan 2017 07:54:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cO28O-0003Kj-NH for guix-devel@gnu.org; Mon, 02 Jan 2017 07:54:45 -0500 Received: from venus.bbbm.mdc-berlin.de ([141.80.25.30]:57482) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cO28O-0003K0-C1 for guix-devel@gnu.org; Mon, 02 Jan 2017 07:54:40 -0500 Received: from localhost (localhost [127.0.0.1]) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTP id 64D1538068C for ; Mon, 2 Jan 2017 13:54:36 +0100 (CET) Received: from venus.bbbm.mdc-berlin.de ([127.0.0.1]) by localhost (venus.bbbm.mdc-berlin.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nvxqtyx8YOqS for ; Mon, 2 Jan 2017 13:54:31 +0100 (CET) Received: from HTCATWO.mdc-berlin.net (puck.citx.mdc-berlin.de [141.80.36.101]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by venus.bbbm.mdc-berlin.de (Postfix) with ESMTPS for ; Mon, 2 Jan 2017 13:54:31 +0100 (CET) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" 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 =E2=80=9Cguix environment=E2=80=9D build a temporary profile cont= aining coreutils (for =E2=80=9Cln=E2=80=9D), bash (for =E2=80=9Csh=E2=80=9D), = and emacs * inside the environment $GUIX_ENVIRONMENT points to the profile; take all of the requisites for this profile (=E2=80=9Cguix gc --requisites=E2= =80=9D) and send them to =E2=80=9Cdocker import=E2=80=9D using a tar pipe * modify the base image such that it links the profile=E2=80=99s =E2=80=9C= bin=E2=80=9D directory to =E2=80=9C/bin=E2=80=9D when a derivative image is built * name that base image =E2=80=9Cemacs-base=E2=80=9D * then build a derivative of this base image with =E2=80=9Cdocker build=E2= =80=9D (this causes =E2=80=9Cln -s=E2=80=9D to be executed) and make it run the comm= and =E2=80=9C/bin/emacs=E2=80=9D by default The result is an unnamed image (=E2=80=9Cdocker build=E2=80=9D reports an= image id such as =E2=80=9Cae8d6281b56f=E2=80=9D) that can be run interactively like thi= s: docker run -it --rm ae8d6281b56f What do you think? Gross? ~~ Ricardo