From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Allan Webber Subject: Re: Creating a docker image with Guix Date: Mon, 02 Jan 2017 20:28:57 -0600 Message-ID: <871swkho5y.fsf@dustycloud.org> References: 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]:55354) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOEqW-0006W4-Pn for guix-devel@gnu.org; Mon, 02 Jan 2017 21:29:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOEqT-0001cM-Kn for guix-devel@gnu.org; Mon, 02 Jan 2017 21:29:04 -0500 Received: from dustycloud.org ([50.116.34.160]:53148) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cOEqT-0001cF-FL for guix-devel@gnu.org; Mon, 02 Jan 2017 21:29:01 -0500 In-reply-to: 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: Ricardo Wurmus Cc: guix-devel 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 =E2=80=9Cguix environment=E2=80=9D build a temporary profile co= ntaining > 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= =9Cbin=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 co= mmand > =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 t= his: > > 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