help-guix
[Top][All Lists]
Advanced

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

Re: Docker image not working


From: Stephen Scheck
Subject: Re: Docker image not working
Date: Thu, 28 Nov 2019 16:08:43 -0600

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 <address@hidden>
wrote:

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


reply via email to

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