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

Updating readme to include build of writable image #2

Merged
merged 2 commits into from
Jan 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions nginx-jupyter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,36 @@ If you haven't installed singularity, do that with [these instructions](http://s
cd singularity-web


Let's now create a jupyter notebook!
Let's now create a jupyter notebook! Since we need a writable image, we issue the `--writable` to build:

cd nginx-jupyter
sudo singularity create --size 4000 jupyter.img
sudo singularity bootstrap jupyter.img Singularity
sudo singularity build --writable jupyter.simg Singularity

Then to run our container, since we need to write files to `/opt/notebooks` inside the container, we must use sudo and add the `--writable` command:
and you could also build into a folder, if you want to easily browse files (this might be the best option for this use case)

sudo singularity run --writable jupyter.img
sudo singularity build --sandbox jupyter.simg Singularity

Note that in the second option, the result is a folder and not a single image. Then to run our container, since we need to write files to `/opt/notebooks` inside the container, we must use sudo and add the `--writable` command:

sudo singularity run --writable jupyter.simg

When we open the browser, we see our server! Cool!

![jupyter.png](jupyter.png)

Since the notebooks are being written to the image, this means that all of our work is preserved in it. I can finish working, close up shop, and hand my image to someone else, and it's preserved. Here, I'll show you. Let's shell into the container after we've shut down the server (note that I didn't need to use sudo for this).

sudo singularity shell jupyter.img
sudo singularity shell jupyter.simg
Singularity: Invoking an interactive shell within container...

Singularity.jupyter.img> ls /opt/notebooks
Singularity.jupyter.simg> ls /opt/notebooks
Untitled.ipynb

There it is! I really should work on naming my files better :) That is so cool.

You can also map to a folder on your local machine, if you don't want to save the notebooks inside:

sudo singularity run -B $PWD:/opt/notebooks --writable jupyter.img
sudo singularity run -B $PWD:/opt/notebooks --writable jupyter.simg

and here I am sitting in my local directory, but the entire software and depdencies are provided by my container. STILL really cool.

Expand Down