unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Simon Tournier <zimon.toutoune@gmail.com>
To: Kyle Andrews <kyle@posteo.net>, help-guix@gnu.org
Subject: Re: guix pack isolation
Date: Tue, 14 Feb 2023 19:46:57 +0100	[thread overview]
Message-ID: <874jroyti6.fsf@gmail.com> (raw)
In-Reply-To: <87wn4qgy6a.fsf@posteo.net>

Hi,

On ven., 10 févr. 2023 at 00:25, Kyle Andrews <kyle@posteo.net> wrote:

> I am wondering how I can/should go about isolating containers created
> using `guix pack`. Right now they are inheriting configurations from my
> personal user folder.
>
> My system administrators are still quite skeptical about installing
> Guix, but they have made it convenient to submit singularity container
> jobs via SLURM. Otherwise, I would prefer to use `guix shell` because it
> seems to make it easy to create a fully isolated container.

From my point of view, you have 2 options: relocatable or squashfs.

About relocatable pack, you might be interested by:

    https://hpc.guix.info/blog/2020/05/faster-relocatable-packs-with-fakechroot/


About squashfs (Singularity container), you can try:

    guix pack -f squashfs python python-numpy bash-minimal -S /bin=bin

which will produce a compressed squashfs that you then import with
Singularity.  I do not have Singularity at hand, let demo with Docker
which is very similar.

1. Produce the pack on the machine running Guix

--8<---------------cut here---------------start------------->8---
$ guix pack -f docker python python-numpy bash -S /bin=bin
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
The following derivations will be built:
  /gnu/store/nid89k59pcxkl6lg7mlppqk8qmizbn6p-python-python-numpy-bash-docker-pack.tar.gz.drv
  /gnu/store/jlib2ngiianwv6854c1kbl6zlgixxg48-module-import.drv
  /gnu/store/irsn92v5ykaxb4yrynrr45hp6jkd4cxc-profile.drv

1,2 MB will be downloaded
substitute: updating substitutes from 'https://ci.guix.gnu.org'... 100.0%
substitute: updating substitutes from 'https://bordeaux.guix.gnu.org'... 100.0%
 guile-json-3.5.0  44KiB              1.1MiB/s 00:00 [##################] 100.0%
 module-import  1KiB                  508KiB/s 00:00 [##################] 100.0%
building profile with 3 packages...
 module-import-compiled  1.1MiB       5.4MiB/s 00:00 [##################] 100.0%
building /gnu/store/nid89k59pcxkl6lg7mlppqk8qmizbn6p-python-python-numpy-bash-docker-pack.tar.gz.drv...
/gnu/store/i3hkgkjq672hic4nkn4g718b9sggg4rh-python-python-numpy-bash-docker-pack.tar.gz
--8<---------------cut here---------------end--------------->8---

2. Transfer the produce pack (…-docker-pack.tar.gz) to the machine without Guix.
3. Load the pack and use it!

--8<---------------cut here---------------start------------->8---
$ docker load < my-docker-pack.tar.gz
Loaded image: python-python-numpy-bash:latest

$ docker run -ti python-python-numpy-bash:latest python3
Python 3.9.9 (main, Jan  1 1970, 00:00:01) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
import numpy as np
>>> A = np.array([[1,0,1],[0,1,0],[0,0,1]]);
A = np.array([[1,0,1],[0,1,0],[0,0,1]]);
>>> _, s, _ = np.linalg.svd(A); s; abs(s[0] - 1./s[2])
_, s, _ = np.linalg.svd(A); s; abs(s[0] - 1./s[2])
array([1.61803399, 1.        , 0.61803399])
0.0
>>> 
--8<---------------cut here---------------end--------------->8---

Cheers,
simon

    


  reply	other threads:[~2023-02-14 19:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  0:25 guix pack isolation Kyle Andrews
2023-02-14 18:46 ` Simon Tournier [this message]
2023-02-15 23:56   ` Kyle Andrews
2023-02-16  9:44     ` Simon Tournier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jroyti6.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=help-guix@gnu.org \
    --cc=kyle@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).