[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Docker image not working

From: Maxim Cournoyer
Subject: Re: Docker image not working
Date: Fri, 29 Nov 2019 02:09:40 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello Stephen,

Stephen Scheck <address@hidden> writes:

> Hello,
> I'm trying to use the `guix system` command to create a Docker image as
> documented here:
> 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

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

This command allows you to produce symlinks in the generated image, for

--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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]