笔记-创建jupyter-lab的docker容器步骤

1,拉取最新ubuntu镜像

docker pull ubuntu

2,使用该镜像启动jupyter容器

docker run -p 8888:8888 -itd --name jupyter ubuntu /bin/bash

3,以进入后再退出容器终端不会导致容器的停止的方式进入容器

docker exec -it jupyter /bin/bash

4,修改成阿里源

tee /etc/apt/sources.list <<-'EOF'
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
EOF

5,检查可用的更新并更新

apt update -y
apt upgrade -y

6,安装一些必须软件(vim、curl、wget、python3、python3-pip)

apt install vim curl wget python3 python3-pip -y

7,更换pip国内源

mkdir ~/.pip
tee ~/.pip/pip.conf <<-'EOF'
[global]
trusted-host =  mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple
EOF

8,升级pip

pip3 install --upgrade pip

9,安装jupyterlab

pip install jupyterlab

10,安装nodejs

curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt install nodejs -y
nodejs --version

11,生成jupyterlab的配置文件

jupyter lab --generate-config

12,生成密码

在终端输入ipython,在ipython中输入
from notebook.auth import passwd
passwd()

在其提示下输入密码后生成该密码的sha1码(如’sha1:bfacc3698c16:ffe503dxxxxx0e3483fffed5’),
复制该码备用

13,修改jupyterlab的配置文件

vim ~/.jupyter/jupyter_notebook_config.py

可修改以下配置等信息

c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:bfacc3698c16:ffe503dxxxxx0e3483fffed5'# 此为上述密码的sha1码
c.NotebookApp.ip = '*'
c.NotebookApp.port = 8888

14,exit退出容器后可使用 docker commit 来提交容器副本生成我们的新镜像

docker commit -m="jupyterlab ubuntu" jupyter jupyterlab

15,可以使用 docker images 命令来查看新镜像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值