Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper for running apptainer on Mac #1101

Merged
merged 1 commit into from
Oct 16, 2022

Conversation

afbjorklund
Copy link
Member

Now that Apptainer has been moved from experimental, and accepted as LF project, it might be time for a wrapper ?

There is no client for apptainer, similar to nerdctl.

So use a small shell wrapper, to run "lima apptainer".

This is so that the user can follow the documentation, without having to write an extra lima prefix before every command:

https://apptainer.org/docs/user/main/quick_start.html

We might still have to document the read-only home.

FATAL:   While performing build: while creating SIF: while creating container: open /home/anders/lima/alpine.sif: read-only file system

This is different from the situation for docker and podman.

Since they already have client binaries, available for Mac.

@AkihiroSuda AkihiroSuda added this to the v0.12.1 milestone Oct 14, 2022
@afbjorklund
Copy link
Member Author

afbjorklund commented Oct 14, 2022

It would be nice if this shell wrapper could automatically add the -B $HOME:$HOME mount, to run or exec.

apptainer run docker://python:alpine python hello.py

Currently you will only get the local home (/home/anders.linux), but not the remote home (/home/anders)

/usr/local/bin/python: can't open file '/home/anders.linux/hello.py': [Errno 2] No such file or directory

One possibility would be to use -H $HOME.

But it doesn't work well with --fakeroot.

EDIT: Use the APPTAINER_HOME for this.

$ apptainer.lima run docker://python:alpine python hello.py
INFO:    Using cached SIF image
Hello, World!

There is no client for apptainer, similar to nerdctl.

So use a small shell wrapper, to run "lima apptainer".

Make sure to set the home directory, for default mount.

The cache files and such, still live in VM ~/.apptainer

Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants