docker 镜像制作(jupyter)
Posted adolfmc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker 镜像制作(jupyter)相关的知识,希望对你有一定的参考价值。
docker pull centos
docker run -it -d --name test-centos1 centos
docker exec -it test-centos1 /bin/bash
docker commit test-centos1 centos_sshd:7.0
docker commit -a "huatong.com" -m "my jupyterhub" 510fda4cf386 jupyterhub:2.1
基础镜像启动
docker run -it -d --name test-centos1 efb6dd7c8649
docker run -it -d --name test-centos1 9aec5c5fe4ba
docker run -it -d --name service_C -p 8889:8000 9aec5c5fe4ba
docker run -it -d -p 8889:8000 --restart=always --name jupyterhub 510fda4cf386 /opt/start.sh
docker run -it -d -p 8889:8000 -p 8887:8888 -p 8886:22 --restart=always --name jupyterhub 025005d90ae7 /opt/start.sh
导出镜像
docker save efb6dd7c8649 > test-save.tar
docker save efb6dd7c8649 > anaconda3_docker_export_images.tar
导入镜像
docker load < test-save.tar
进入容器
docker exec -it test-centos1 /bin/bash
docker exec -it service_A /bin/bash
启动jupter
nohup jupyter notebook --allow-root &
jupyter notebook --allow-root --config /root/.jupyter/jupyter_notebook_config.py
jupyterhub --config /root/.jupyter/jupyterhub_config.py --no-ssl > jupyterhub.log
jupyterhub --config /jupyterhub --config /root/.jupyter/jupyterhub_config.py --no-ssl > jupyterhub.log
jupyterhub --config /home/mal/jupyterhub_config.py --no-ssl > jupyterhub.log
jupyterhub -f ./jupyterhub_config.py
docker pull centos
docker run -it -d --name test-centos1 centos
docker exec -it test-centos1 /bin/bash
docker commit test-centos1 centos_sshd:7.0
docker run -d -t -v /etc/localtime:/etc/localtime -p 8889:8889 --name service_A imageX
conda install -c anaconda pymysql
from sqlalchemy import create_engine
engine=create_engine(‘mysql+pymysql://username:password.@HOST_IP:PORT/db_name?charset=utf8‘)
conn = engine.connect()
r = conn.execute(‘select sysdate()‘)
查看 centos version
cat /etc/redhat-release
linux 离线安装缺少包可强制安装
rpm -ivh --nodeps createrepo-0.9.9-28.el7.noarch.rpm #意思不考虑依赖
centos1
docker exec -it 93b7ef3dd8f8 /bin/bash 172.31.254.3
creditapp
docker exec -it 9999d669359a /bin/bash 172.31.254.7
xxl-job
docker exec -it 05f5424f45a4 /bin/bash 172.31.254.6
docker cp ./ROOT 05f5424f45a4:/usr/local/tomcat/webapps/ROOT
fastdfs
172.31.254.8
从服务器下载整个目录
scp -r root@172.96.190.155:/data/ROOT/ ./
docker cp /data/bak/ROOT 93b7ef3dd8f8:/data
离线安装docker步骤
------------------------------------------------------------------------------------------
cd ~/test/rpms
# --force --nodeps 选择强制安装和替换
rpm -ivh *.rpm --force --nodeps
4.启动
systemctl start docker
5.查看
systemctl status docker
anconda 安装pyodbc
---------------------------------------------------------------------------------
conda install -c anaconda pyodbc
参考代码import pyodbc
#connect odbc
cnxn = pyodbc.connect(“DSN=your_inceptor_odbc_data_source_name”)
cursor = cnxn.cursor()
#create table
cursor.execute(“create table tt(c1 int , c2 int) clustered by (c1) into 1 buckets stored as orc TBLProperties (“transactional”=“true”)”)
#insert data
cursor.execute(“insert into tt values (?,?)”, 1,1)cursor.execute(“insert into tt values (?,?)”, 2,2)
#select data
row = cursor.execute(“select * from tt”).fetchone()
print row
#drop table
cursor.execute(“drop table tt”)cnxn.close()
from impala.dbapi import connect
conn = connect(host="xx.11.0.160", port=10000, database="dsi", user="xxxx", password="xxxx", auth_mechanism="PLAIN")
cur = conn.cursor()
cur.execute(" select * from dsi.I_RCS_BM_CC_BUSINESS_CHANNEL_H limit 10")
print (cur.fetchone())
conn.close()
以上是关于docker 镜像制作(jupyter)的主要内容,如果未能解决你的问题,请参考以下文章
docker第四天:制作docker镜像——手工制作docker镜像