miniconda3 setup
miniconda3 conda install jupyter numpy scipy matplotlib pandas
miniconda3 # Bash
miniconda3 ipython # IPython
miniconda3 notebook
#!/usr/bin/env bash | |
set -e | |
IMAGE="docker.io/continuumio/miniconda3:latest" | |
HOST_CONDA_DIR="/opt/conda" | |
HOST_NOTEBOOK_DIR="${PWD}" | |
HOST_NOTEBOOK_PORT="8888" | |
podman_cmd=("${@:-/bin/bash}") | |
podman_opt=() | |
case "${podman_cmd[0]}" in | |
setup) | |
sudo mkdir -p "${HOST_CONDA_DIR}" | |
tmpcid="$(sudo podman create "${IMAGE}")" | |
sudo podman cp "${tmpcid}:/opt/conda/." "${HOST_CONDA_DIR}" | |
sudo podman rm "${tmpcid}" | |
exit 0 | |
;; | |
notebook) | |
if avahi-daemon -c >/dev/null 2>&1; then | |
jupyter_hostname="$(hostname).local" | |
else | |
jupyter_hostname="$(hostname --fqdn)" | |
fi | |
jupyter_display_url="http://${jupyter_hostname}:${HOST_NOTEBOOK_PORT}" | |
jupyter_opt=( | |
"--ip=0.0.0.0" | |
"--port=8888" | |
"--notebook-dir=/opt/notebooks" | |
"--allow-root" | |
"--no-browser" | |
"--NotebookApp.custom_display_url=${jupyter_display_url}") | |
podman_cmd=(jupyter notebook "${jupyter_opt[@]}") | |
podman_opt+=( | |
"-p" "${HOST_NOTEBOOK_PORT}:8888" | |
"-v" "${HOST_NOTEBOOK_DIR}:/opt/notebooks") | |
;; | |
help) | |
prog="$(basename "$0")" | |
printf >&2 'e.g. %s {setup,notebook,help}\n' "${prog}" | |
printf >&2 ' %s [COMMAND]\n' "${prog}" | |
exit 0 | |
;; | |
esac | |
exec sudo podman run -it --rm \ | |
-v "${HOST_CONDA_DIR}:/opt/conda" \ | |
"${podman_opt[@]}" "${IMAGE}" "${podman_cmd[@]}" |