From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: Re: Creating a docker image with Guix Date: Tue, 3 Jan 2017 11:45:59 +0100 Message-ID: References: <87eg0l85qm.fsf@gnu.org> 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]:32892) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOMbm-0008Ly-8Q for guix-devel@gnu.org; Tue, 03 Jan 2017 05:46:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOMbj-0007o7-6a for guix-devel@gnu.org; Tue, 03 Jan 2017 05:46:22 -0500 In-Reply-To: <87eg0l85qm.fsf@gnu.org> 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: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel Ludovic Court=C3=A8s writes: > Ricardo Wurmus 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=E2=80=99s very hard to tell because this command doesn=E2=80=99t spit = out a file that fully represents the image. Instead it modifies some state in /var/lib/docker. > Would it be enough to generate an =E2=80=9CImage JSON Description=E2=80= =9D in this > format: = ? No. On Fedora (where I ran the above command) Docker uses the devicemapper backend. =E2=80=9Cdocker build=E2=80=9D appears to have cre= ated an XFS file system in a file. Different installations use different backends (e.g. direct-lvm or aufs) =E2=80=94 this probably means that we should no= t try to build an image for a particular backend directly. However, there is a =E2=80=9Cdocker save=E2=80=9D command to export an im= age 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 =E2=80=9Clayer.tar=E2=80=9D archives. The first contains t= he files of the base image (i.e. all the /gnu/store stuff), the second contains the added symlink from =E2=80=9C/bin=E2=80=9D to =E2=80=9C/gnu/store/.../bin=E2= =80=9D (and =E2=80=9C/run/secrets=E2=80=9D). > I=E2=80=99m not familiar enough with Docker but I=E2=80=99m under the i= mpression that we > should be able to generate an image without even using Docker. :-) Absolutely! Now that I know about =E2=80=9Cdocker save=E2=80=9D I=E2=80=99= ll give it another try. ~~