如何在centos的docker里安装jupyter并开放端口

来自:网络
时间:2021-10-02
阅读:
目录
安装 jupyterdocker 端口映射

安装 jupyter

pip install jupyter

编写脚本运行:

#!/bin/bash
# run_jupyter.sh
jupyter notebook --no-browser --ip 0.0.0.0 --port 8888 --allow-root > .log 2>&1 &

可以把这个脚本加入开机运行

docker 端口映射

先把安装好jupyter的容器提交

docker commit -a '作者' -m "add jupyter" 容器名 ubuntu:jupyter

以新镜像建立容器

docker run -itd --name jupyter ubuntu:jupyter -p 80:8888 bash

开放宿主机防火墙

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-port
firewall-cmd --query-port=80/tcp

用浏览器访问宿主机

如何在centos的docker里安装jupyter并开放端口

所以我的开发环境是这样的哈哈哈

如何在centos的docker里安装jupyter并开放端口

返回顶部
顶部