94 lines
3.6 KiB
Markdown
Executable File
94 lines
3.6 KiB
Markdown
Executable File
# Base Jupyter Notebook Stack
|
||
|
||
> **Images hosted on Docker Hub are no longer updated. Please, use [quay.io image](https://quay.io/repository/jupyter/base-notebook)**
|
||
|
||
[](https://hub.docker.com/r/jupyter/base-notebook/)
|
||
[](https://hub.docker.com/r/jupyter/base-notebook/)
|
||
[](https://hub.docker.com/r/jupyter/base-notebook/ "jupyter/base-notebook image size")
|
||
|
||
GitHub Actions in the <https://github.com/jupyter/docker-stacks> project builds and pushes this image to the Registry.
|
||
|
||
Please visit the project documentation site for help to use and contribute to this image and others.
|
||
|
||
- [Jupyter Docker Stacks on ReadTheDocs](https://jupyter-docker-stacks.readthedocs.io/en/latest/index.html)
|
||
- [Selecting an Image :: Core Stacks :: jupyter/base-notebook](https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-base-notebook)
|
||
|
||
# 构建docker-compose spawner镜像的Dockerfile
|
||
|
||
构建基[础镜像参考](https://github.com/jupyter/docker-stacks)
|
||
|
||
```shell
|
||
cp docker-stacks/images/base-notebook/* ./spawnerdockerfile/
|
||
cd spawnerdockerfile
|
||
docker buildx build -t hotwa/notebook:latest . -f Dockerfile.base-notebook --load
|
||
```
|
||
|
||
# 添加虚拟环境到jupyterhub
|
||
|
||
```shell
|
||
# 创建新的虚拟环境
|
||
micromamba create -n plot -c conda-forge scienceplots autopep8 python=3 ipykernel pandas numpy matplotlib scipy seaborn orange3 -y
|
||
micromamba run -n plot python -m pip install bamboolib
|
||
# 激活需要添加的虚拟环境
|
||
micromamba activate plot
|
||
# 环境中安装ipykernel
|
||
micromamba install -c conda-forge ipykernel -y
|
||
# 将新的虚拟环境添加为一个jupyter的内核
|
||
micromamba run -n plot python -m ipykernel install --user --name="sciplot" --display-name="SCIPlot Environment"
|
||
```
|
||
|
||
# micromamba 提示需要初始化 解决方法
|
||
|
||
```shell
|
||
eval "$(micromamba shell hook --shell bash)"
|
||
```
|
||
|
||
或者使用
|
||
|
||
```shell
|
||
miromamba init
|
||
source ~/.bashrc
|
||
```
|
||
|
||
这个操作会激活micromamba(mamba, conda)的安装目录`etc/profile.d/micromamba.sh`激活添加到bash初始化文件`.bashrc`里面
|
||
|
||
# docker镜像
|
||
|
||
关于这个jupyterlab的spawner的notebook启动的镜像来源于:quay.io/jupyterdocker-stacks-foundation
|
||
|
||
这个镜像的构建仓库是:https://github.com/jupyter/docker-stacks/blob/main/images/docker-stacks-foundation/Dockerfile
|
||
|
||
可以把这个Dockerfile的ARG参数ROOT_CONTAINER修改为docker pull nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04
|
||
|
||
pytorch-notebook构建顺序是:
|
||
|
||
docker-stacks-foundation
|
||
base-notebook
|
||
minimal-notebook
|
||
scipy-notebook
|
||
pytorch-notebook
|
||
|
||
第一步
|
||
|
||
```shell
|
||
git clone https://github.com/jupyter/docker-stacks.git
|
||
cd docker-stacks/images/docker-stacks-foundation
|
||
docker buildx build --build-arg ROOT_CONTAINER=nvidia/cuda:12.4.1-cudnn-devel-ubuntu22.04 -t quay.io/hotwa/docker-stacks-foundation:latest . --load # docker pull nvidia/cuda:12.4.1-devel-ubuntu22.04
|
||
cd ../base-notebook
|
||
docker buildx build --build-arg OWNER=hotwa -t quay.io/hotwa/base-notebook:latest . --load
|
||
cd ../minimal-notebook/
|
||
docker buildx build --build-arg OWNER=hotwa -t quay.io/hotwa/minimal-notebook:latest . --load
|
||
cd ../scipy-notebook
|
||
docker buildx build --build-arg OWNER=hotwa -t quay.io/hotwa/scipy-notebook:latest . --load
|
||
cd ../pytorch-notebook
|
||
docker buildx build --build-arg OWNER=hotwa -t quay.io/hotwa/pytorch-notebook:latest . --load
|
||
```
|
||
|
||
# 然后构建自己的基础镜像
|
||
|
||
```shell
|
||
docker buildx build --build-arg OWNER=hotwa -t quay.io/hotwa/notebook:latest -f Dockerfile.base-notebook . --load
|
||
# 导出保存
|
||
|
||
```
|