本文主要是介绍自定义Docker镜像--Jupyterlab,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
概述
自定义Jupyterlab镜像,为deployment做准备
步骤
下载基础镜像:centos:7.9.2009
docker search centos:7.9.2009
docker pull centos:7.9.2009
启动容器 + 部署应用
# 启动容器
docker run -it --name test centos:7.9.2009 bash# 在容器内部署应用服务
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-develyum -y install vim git wget python3 python-pip epel-release gcc make gcc-c++ mysql redis# 在容器内安装python module
pip3.6 install jupyterlab
pip3.6 install pymysql
pip3.6 install redis# 重新构建python3的软连接
ls -al /usr/bin | grep python
ls -al /usr/bin | grep pipmv /usr/bin/python /usr/bin/python.bakup
ln -s /usr/bin/python3.6 /usr/bin/python
ln -s /usr/bin/pip3.6 /usr/bin/pip
配置jupyterlab
执行命令:
jupyter lab --generate-config
修改配置文件:/root/.jupyter/jupyter_lab_config.py
# 查看正在运行容器
docker ps
# 将配置文件从容器中,copy到主机中
docker cp 66978dcc6378:/root/.jupyter/jupyter_lab_config.py ./
c.ServerApp.root_dir = '/home/jupyterlab'
c.ServerApp.allow_remote_access = True
c.ServerApp.ip = '*'
c.LabApp.open_browser = False
c.ServerApp.port = 8888
c.ServerApp.allow_root = True
配置启动文件:jupyter.service
# 启动文件转移出来
docker cp 66978dcc6378:/etc/systemd/system/jupyter.service ./
查看内容:
[Unit]
Description=jupyter
After=network.target[Service]
Type=simple
ExecStart=/usr/local/bin/jupyter-lab > /home/jupyter-lab.log
ExecReload=/bin/kill -s HUP $MAINPID
RestartSec=2s
Restart=on-failure[Install]
WantedBy=multi-user.target
方式二
基于python的官方镜像安装jupyterlab + pandas + redis + pymysql + prettytable
这篇关于自定义Docker镜像--Jupyterlab的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!