all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* guix pack -f docker and profile ?
@ 2019-05-16 18:26 zimoun
  2019-05-19 14:38 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: zimoun @ 2019-05-16 18:26 UTC (permalink / raw)
  To: help-guix

Dear,

The command line:

  guix pack                 \
            -f docker       \
            -C none         \
            -S /bin=bin     \
            -S /lib=lib     \
            -S /share=share \
            -S /etc=etc     \
            glibc-utf8-locales coreutils tzdata \
            bash r r-<name-it>

creates a Docker image containing the R interpreter and the R package
<name-it>. Nice!

Then:
  docker run -ti --rm --tmpfs /tmp <image-id> R
launches R inside the Docker. Cool!

However you cannot load the R package <name-it> because it is not in
the load path. Which is annoying but expected.

Instead, one needs to make it with 2 steps:
  docker run -ti --rm --tmpfs /tmp <image-id> bash
then find the <hash> from the folder /gnu/store/<hash>-profile to be
able to source it:
  source /gnu/store/<hash>-profile/etc/profile

Now the R library is found:
  R -e 'library(<name-it>)'


Is it possible to directly have the profile under /etc/ ?
Other said, how to correctly expose the environment variables ?


Thank you in advance.


All the best,
simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guix pack -f docker and profile ?
  2019-05-16 18:26 guix pack -f docker and profile ? zimoun
@ 2019-05-19 14:38 ` Ludovic Courtès
  2019-05-20 13:15   ` zimoun
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2019-05-19 14:38 UTC (permalink / raw)
  To: zimoun; +Cc: help-guix

Hello Simon!

zimoun <zimon.toutoune@gmail.com> skribis:

> However you cannot load the R package <name-it> because it is not in
> the load path. Which is annoying but expected.
>
> Instead, one needs to make it with 2 steps:
>   docker run -ti --rm --tmpfs /tmp <image-id> bash
> then find the <hash> from the folder /gnu/store/<hash>-profile to be
> able to source it:
>   source /gnu/store/<hash>-profile/etc/profile
>
> Now the R library is found:
>   R -e 'library(<name-it>)'

By using ‘-S /etc=etc’, you provide /etc/profile in the container.
Thus, if you run “bash” (or “bash --login”?) in there, /etc/profile is
automatically sourced, which solves the problem, I think.

But it’s not very convenient.

> Is it possible to directly have the profile under /etc/ ?
> Other said, how to correctly expose the environment variables ?

Perhaps we should populate the ‘Environment’ bit of the Docker manifest
file?  It sounds like it would greatly improve things.

WDYT?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: guix pack -f docker and profile ?
  2019-05-19 14:38 ` Ludovic Courtès
@ 2019-05-20 13:15   ` zimoun
  0 siblings, 0 replies; 3+ messages in thread
From: zimoun @ 2019-05-20 13:15 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix

Hi Ludo,

On Sun, 19 May 2019 at 16:38, Ludovic Courtès <ludo@gnu.org> wrote:
>
> Hello Simon!
>
> zimoun <zimon.toutoune@gmail.com> skribis:
>
> > However you cannot load the R package <name-it> because it is not in
> > the load path. Which is annoying but expected.
> >
> > Instead, one needs to make it with 2 steps:
> >   docker run -ti --rm --tmpfs /tmp <image-id> bash
> > then find the <hash> from the folder /gnu/store/<hash>-profile to be
> > able to source it:
> >   source /gnu/store/<hash>-profile/etc/profile
> >
> > Now the R library is found:
> >   R -e 'library(<name-it>)'
>
> By using ‘-S /etc=etc’, you provide /etc/profile in the container.
> Thus, if you run “bash” (or “bash --login”?) in there, /etc/profile is
> automatically sourced, which solves the problem, I think.

This was my expectation by using `-S /etc=etc` but I am not sure it
works. Or I miss something.

For example, I run:

 docker run -ti --rm --tmpfs /tmp 6d1dfcc93a87 bash --login

or without --login. Then nothing "useful" is sourced.

Moreover, `ls -al /etc/` returns:
total 20
drwxr-xr-x 2 0 0 4096 May 20 13:01 .
drwxr-xr-x 1 0 0 4096 May 20 13:01 ..
-rw-r--r-- 1 0 0   13 May 20 13:01 hostname
-rw-r--r-- 1 0 0  174 May 20 13:01 hosts
lrwxrwxrwx 1 0 0   12 May 20 13:01 mtab -> /proc/mounts
-rw-r--r-- 1 0 0  111 May 20 13:01 resolv.conf

I mean the profile is still under for example
`/gnu/store/n8sfl91mk8xrcrl325lc46ajihjssi8d-profile/etc/profile` and
it is really annoying to find the hash.

Maybe I miss something.
For the record, I am working on a foreign distro.

> But it’s not very convenient.
>
> > Is it possible to directly have the profile under /etc/ ?
> > Other said, how to correctly expose the environment variables ?
>
> Perhaps we should populate the ‘Environment’ bit of the Docker manifest
> file?  It sounds like it would greatly improve things.

I am not sure it will fix the issue here. However, it should improve
things for the issues described there:
https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00326.html
(if I understand what a Docker mainifest file is)



All the best,
simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-20 13:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 18:26 guix pack -f docker and profile ? zimoun
2019-05-19 14:38 ` Ludovic Courtès
2019-05-20 13:15   ` zimoun

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.