From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Scheck Subject: Re: Docker image not working Date: Thu, 28 Nov 2019 16:08:43 -0600 Message-ID: References: <87sgm8rkq3.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37939) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iaRyH-00059v-OW for help-guix@gnu.org; Thu, 28 Nov 2019 17:09:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iaRy6-0006oM-UW for help-guix@gnu.org; Thu, 28 Nov 2019 17:09:03 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:44626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iaRy5-0006fl-3i for help-guix@gnu.org; Thu, 28 Nov 2019 17:08:58 -0500 Received: by mail-lj1-x22f.google.com with SMTP id c19so2843292lji.11 for ; Thu, 28 Nov 2019 14:08:56 -0800 (PST) In-Reply-To: <87sgm8rkq3.fsf@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Maxim Cournoyer Cc: help-guix I don't think the docs are quite up to date, or perhaps refer to an older version of Docker. If I do: $ docker create system:0qjxd5ljsh316ki7wqkk2xz9b68lynh2 Error response from daemon: No command specified Looks like `docker create` wants the entry point, hence why I tried to use `docker run` to fire up the container ... so what should it be to kick off the Shepherd service you referred to? Thanks. On Thu, Nov 28, 2019 at 11:09 AM Maxim Cournoyer wrote: > Hello Stephen, > > Stephen Scheck writes: > > > Hello, > > > > I'm trying to use the `guix system` command to create a Docker image as > > documented here: > > > > > > > https://guix.gnu.org/manual/en/html_node/Invoking-guix-system.html#Invoking-guix-system > > > > However, the created image does not work: > > > > $ docker run -it system:0qjxd5ljsh316ki7wqkk2xz9b68lynh2 > > /run/current-system/profile/bin/bash --login > > docker: Error response from daemon: OCI runtime create failed: > > container_linux.go:348: starting container process caused "exec: > > \"/run/current-system/profile/bin/bash\": stat > > /run/current-system/profile/bin/bash: no such file or directory": > unknown. > > > > This is the command I invoked to create the image: > > > > guix system init --no-bootloader --skip-checks --system=x86_64-linux > > guix-docker.scm /tmp/guix/docker-image > > > > And here is the system configuration I used: > > > > (use-modules (gnu)) > > (use-package-modules admin base bash less linux) > > > > (operating-system > > (host-name "guix") > > (timezone "UTC") > > (locale "en_US.utf8") > > > > (bootloader (bootloader-configuration > > (bootloader grub-bootloader) > > (target "/dev/null"))) > > (file-systems (cons (file-system > > (device (file-system-label > "guix-system-dummy")) > > (mount-point "/") > > (type "ext4")) > > %base-file-systems)) > > > > (packages (append (list bash coreutils-minimal inetutils less > procps > > which) %base-packages))) > > > > Am I missing something? > > Yes! The /run/current-system/profile/bin/bash symlink you are trying to > invoke is setup by one of the Shepherd services when the Guix system is > initialized. Here the system hasn't booted up yet. Currently the > system is initialized as part of the default entry point produced by > Guix, but such initialization only spawns Shepherd as PID 1 and leaves > you with a useless, non-interactive session that is not useful when > simply running 'docker run -it $your-image'. > > The only useful way to use a docker-image currently is to "start" the > container, using > > docker start $container_id > > And then attaching to it with docker exec > > docker exec -ti $container_id /run/current-system/profile/bin/bash > --login > > This is explained in the documentation. > > I don't find this really convenient, and intend to modify the default > entry point at some point to allow running commands directly from > 'docker run', but currently it is the way it works. > > What I can recommend for very simple use cases (starting a script, bash, > etc), is to use 'docker pack -f docker' instead to produce the Docker > image. > > This command allows you to produce symlinks in the generated image, for > example: > > --8<---------------cut here---------------start------------->8--- > guix pack --manifest=your-manifest.scm \ > -f docker \ > -S /etc/profile=etc/profile \ > -S /bin=bin > --8<---------------cut here---------------end--------------->8--- > > Will set the /etc/profile, /bin and /sbin links in the target to that of > the profile generated from your-manifest.scm. > > You could then override the default entry point of the docker image with > a command such as: > > docker run -it $your_image /bin/bash --login > > This bash session should source /etc/profile and make all of your > manifest installed software available to experiment with. > > HTH! > > Maxim >