{"id":22599655,"url":"https://github.com/singularityhub/jupyter","last_synced_at":"2025-10-27T14:12:37.630Z","repository":{"id":50135971,"uuid":"76502982","full_name":"singularityhub/jupyter","owner":"singularityhub","description":"official build specifications for jupyter","archived":false,"fork":false,"pushed_at":"2021-06-03T02:05:04.000Z","size":283,"stargazers_count":13,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T00:30:07.024Z","etag":null,"topics":["jupyter","singularity"],"latest_commit_sha":null,"homepage":null,"language":"Singularity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/singularityhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-14T22:39:04.000Z","updated_at":"2024-12-26T18:51:00.000Z","dependencies_parsed_at":"2022-08-30T04:52:43.638Z","dependency_job_id":null,"html_url":"https://github.com/singularityhub/jupyter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singularityhub%2Fjupyter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singularityhub%2Fjupyter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singularityhub%2Fjupyter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/singularityhub%2Fjupyter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/singularityhub","download_url":"https://codeload.github.com/singularityhub/jupyter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248323624,"owners_count":21084549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jupyter","singularity"],"created_at":"2024-12-08T11:11:01.189Z","updated_at":"2025-10-27T14:12:32.608Z","avatar_url":"https://github.com/singularityhub.png","language":"Singularity","readme":"# Jupyter\n\nThis example will show how to run a jupyter notebook server with nginx, from a container (singularity container in this case).\n\n- perhaps you ran an analysis when you created the container, and want to serve the notebook as a result) or\n- perhaps you want this to be like a working container, to store a particular version of your software to use on local files\n\nIf you are interested in more proper container orchestration with [singularity-compose](https://singularityhub.github.io/singularity-compose/), see the [singularity-compose jupyter example](https://github.com/singularityhub/singularity-compose-examples/tree/master/jupyter-simple) that can more easily handle adding other containers as services, volumes, etc.\n\n## Branches\n\n - [Windows Filesystem Support](https://github.com/singularityhub/jupyter/tree/cifs) A basic example for Windows Filesystem Support is on this cifs branch.\n\n## Getting Started\n\nIf you haven't installed singularity, do that with [these instructions](http://singularity.lbl.gov/install-linux). Then download the repo if you haven't already:\n\n```bash\ngit clone https://www.github.com/singularityhub/jupyter\ncd jupyter\n```\n\nLet's now create a jupyter notebook!\nFirst, we will create the writable container image in a _writable_ *ext3* file system, instead of the *squashfs* which only allows _read-only_. [read more](http://singularity.lbl.gov/docs-build-container)\n\n```bash\n$ sudo singularity build --sandbox jupyter-box Singularity\n```\n\nThen 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:\n\n```bash\n$ sudo singularity run --writable jupyter-box\n```\n\nWhen we open the browser, we see our server! Cool!\n\n![jupyter.png](jupyter.png)\n\n**Important** using this container requires the allow-root flag, which isn't great practice.\nIf you really need to run a notebook in a container, you might be better off building one\nthat installs the notebook with your user (e.g. see [this Docker example](https://github.com/hpsee/discourse-cluster/blob/master/Dockerfile) that could be translated to Singularity). You would want to change\nthe user jovyan to your username. If you can, you can also just use Docker! EIther you\ncan use the image linked there, or you can check out [repo2docker](https://github.com/jupyter/repo2docker) to build\na custom container.\n\nSince 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).\n\n```bash\nsudo singularity shell jupyter-box\nSingularity: Invoking an interactive shell within container...\n\nSingularity.jupyter.sif\u003e ls /opt/notebooks\nUntitled.ipynb\n```\n\nThere it is! I really should work on naming my files better :) That is so cool.\n\nYou can also map to a folder on your local machine, if you don't want to save the notebooks inside:\n\n```bash\nsudo singularity run -B $PWD:/opt/notebooks --writable jupyter-box\n```\n\nand here I am sitting in my local directory, but the entire software and depdencies are provided by my container. STILL really cool.\n\n![local.png](local.png)\n## Note on port forwarding\nIf you are running Singularity in Windows through vagrant, you will need to configure port forwarding in the Vagrantfile that you use to set up the Singularity container as well. \nAs an example, you should add a line that might look like this.\n`config.vm.network \"forwarded_port\", guest: 8888, host: 8888, host_ip: \"127.0.0.1\"`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingularityhub%2Fjupyter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsingularityhub%2Fjupyter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsingularityhub%2Fjupyter/lists"}