From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Creating Docker containers in Scheme Date: Wed, 08 Nov 2017 14:55:07 +0100 Message-ID: <878tfgvps4.fsf@gnu.org> References: <87lgjoiuf1.fsf@gnu.org> <87d14tw456.fsf@gnu.org> <87h8u5yut2.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]:37822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCQp2-00019J-7i for guix-devel@gnu.org; Wed, 08 Nov 2017 08:55:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCQow-0005k3-Ja for guix-devel@gnu.org; Wed, 08 Nov 2017 08:55:16 -0500 In-Reply-To: <87h8u5yut2.fsf@gnu.org> (Roel Janssen's message of "Wed, 08 Nov 2017 10:38:17 +0100") 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: Roel Janssen Cc: guix-devel Roel Janssen skribis: > Ludovic Court=C3=A8s writes: [...] >> Move precisely: >> >> (mlet %store-monad ((profile (profile-derivation =E2=80=A6))) >> (docker-image "my-container" profile)) >> > > Oh, of course! :) > > Unfortunately, I cannot seem to get it to work. > Here's what I do (mind the GWL process- stuff): > > (define* (process->docker-derivation proc #:key (guile (default-guile))) > "Return a Docker container that can run the PROCEDURE described in PROC= , with > PROCEDURE's imported modules in its search path." > (let ((name (process-full-name proc)) > (exp (process-procedure proc)) > (out (process-output-path proc)) > (packages (process-package-inputs proc))) > (let ((out-str (if out (format #f "(setenv \"out\" ~s)" out) ""))) > (mlet %store-monad ((set-load-path > (load-path-expression (gexp-modules exp))) > (container (docker-image > (string-append (process-full-name p= roc) > "-docker") > (profile-derivation > (packages->manifest packages))))) ^^ See above. :-) > (gexp->derivation > name > (gexp > (call-with-output-file (ungexp output) > (lambda (port) > (format port "# Docker image: ~a~%" (ungexp container))))) > #:graft? #f))))) > > And the error I get is: > wrong-type-arg: string-prefix? > > Is there anything obviously wrong here? Hmm, we=E2=80=99d need to see the backtrace, but it might be the fact that =E2=80=98profile-derivation=E2=80=99 is not bound (in the sense of >>=3D). >>> Is this something we could add to the the public interface of a module? >> >> Sure. For now the easiest solution would be to export =E2=80=98docker-i= mage=E2=80=99 >> from (guix scripts pack). >> >> Longer-term, we could rename (guix docker) to (guix build docker) and >> move =E2=80=98docker-image=E2=80=99 to a new (guix docker) module, but p= erhaps we=E2=80=99d also >> need a (guix pack) modules containing tools that are shared between the >> docker and tarball backends of =E2=80=98guix pack=E2=80=99. >> >> WDYT? > > It'd be nice to keep the (guix scripts ...) small, and only do > command-line handling. So I think a (guix build docker), and a (guix > pack) module would be good. Yes, I agree that this is the right direction. Ludo=E2=80=99.