Created
September 4, 2022 21:28
-
-
Save marcomalva/7af9cab40e66d2a539034fb195e5576e to your computer and use it in GitHub Desktop.
[Podman - Launch Jupyter Datascience Notebook]Jupyter Notebook with Python, R, Markdown, and Terminal and RW to ~/work #podman #jupyter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# launch datascience-notebook jupypter notebook as podman container with read/write to current folder (~/work folder inside container) | |
# | |
# once launched open notebook in web-browser under: http://localhost:10000 | |
# copy token from podman stdout | |
# | |
# based on official web site, see https://jupyter-docker-stacks.readthedocs.io/en/latest/using/running.html#using-the-podman-cli | |
# see also: [Running rootless Podman as a non-root user | Enable Sysadmin](https://www.redhat.com/sysadmin/rootless-podman-makes-sense) | |
# | |
# simple command starts but can not write to ~/work | |
# podman run -it --rm -p 10000:8888 -v "${PWD}:/home/jovyan/work:Z" jupyter/datascience-notebook | |
uid=${uid:-$(id -u)} | |
gid=${gid:-$(id -g)} | |
subuidSize=$(( $(podman info --format "{{ range .Host.IDMappings.UIDMap }}+{{.Size }}{{end }}" ) - 1 )) | |
subgidSize=$(( $(podman info --format "{{ range .Host.IDMappings.GIDMap }}+{{.Size }}{{end }}" ) - 1 )) | |
podman run -it --rm -p 10000:8888 \ | |
-v "${PWD}:/home/jovyan/work:Z" --user $uid:$gid \ | |
--uidmap $uid:0:1 --uidmap 0:1:$uid --uidmap $(($uid+1)):$(($uid+1)):$(($subuidSize-$uid)) \ | |
--gidmap $gid:0:1 --gidmap 0:1:$gid --gidmap $(($gid+1)):$(($gid+1)):$(($subgidSize-$gid)) \ | |
jupyter/datascience-notebook | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment