[Ubuntu, Docker, Docker Swarm] Docker Swarm 建置 Jupyter Notebook 流程
首先更新apt到最新並下載ipython3以及相關套件
最後暫定指令,指令必須連結至jupyter的預設目錄
- sudo apt update
- sudo apt install python3-pip
- sudo apt install notebook
- ipython
- import IPython
- IPython.lib.passrd()
- 輸入密碼會產生sha密碼
- sudo docker service create --name 'cluster名稱' -d -p 8888:8888 -e GRANT_SUDO=yes jupyter/base-notebook start-notebook.sh --NotebookApp.password='SHA密碼'
- sudo docker service scale 'cluster名稱'=1
- sudo docker exec --user root -it 'cluster名稱' bash
NFS 共享Storage設置
- sudo apt install nfs-kernel-server (manager node)
- sudo apt install nfs-common (worker node)
- sudo vim /etc/exports
- sudo mkdir -p /mount/nfs_volume
- /mount/nfs_volume 192.168.80.0/24(rw,sync,no_root_sqush)
- sudo nfs-kernel-servel restart
- mount -t nfs 192.168.80.129:/mount/nfs_volume /mount/nfs_volume
最後暫定指令,指令必須連結至jupyter的預設目錄
- sudo docker service create --name jup-base --mount 'type=volume,src=nfs_volume,dst=/home/jovyan/work,volume-driver=local,volume-nocopy=true,volume-opt=type=nfs,volume-opt=device=192.168.80.129:/mount/nfs_volume,"volume-opt=o=addr=192.168.80.129,vers=4,soft,timeo=180,bg,tcp,rw"' -d -p 8888:8888 -e GRANT_SUDO=yes jupyter/base-notebook start-notebook.sh --NotebookApp.password='sha1:414cd8d7a179:27ccc76e8f4eff44f236379bdfdb4a4615afd07d'
留言
張貼留言