Last active
August 6, 2023 21:55
-
-
Save mustafaturan/b52e034acc6c6ed61926dc06c076a5c6 to your computer and use it in GitHub Desktop.
Bash script to run jupyter notebook for python3 and pyspark
This file contains hidden or 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 | |
echo "Getting ip address for wlan0"; | |
hostname=$(ip -4 addr show wlan0 | grep -oP "(?<=inet ).*(?=/)"); | |
echo "IP: ${hostname}"; | |
user="pi"; # give a username which will be used for image name and path, it does NOT have to be the same with login username | |
image="scipy"; | |
port=10000; | |
name="${image}${user}"; | |
token="${image}${user}" # update as you wish! | |
echo "${image}:${port}"; | |
mkdir -p "${PWD}/${image}/${user}"; | |
docker stop $name; | |
docker rm $name; | |
docker run --restart always -d --name $name -p $port:8888 -v "${PWD}/${image}/${user}":/home/jovyan/work "jupyter/${image}-notebook" \ | |
start-notebook.sh --IdentityProvider.token="${token}"; | |
echo "http://${hostname}:${port}/lab?token=${token}"; | |
image="pyspark"; | |
port=10001; | |
spark_port=1041 | |
name="${image}${user}"; | |
token="${image}${user}"; # update the token value as you wish! | |
echo "${image}:${port}"; | |
mkdir -p "${PWD}/${image}/${user}"; | |
docker stop $name; | |
docker rm $name; | |
docker run --restart always -d --name $name -p $port:8888 -p $spark_port:4040 -v "${PWD}/${image}/${user}":/home/jovyan/work "jupyter/${image}-notebook" \ | |
start-notebook.sh --IdentityProvider.token="${token}"; | |
echo "http://${hostname}:${port}/lab?token=${token}"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment