码迷,mamicode.com
首页 > 其他好文 > 详细

docker 镜像制作(jupyter)

时间:2019-12-08 10:27:05      阅读:287      评论:0      收藏:0      [点我收藏+]

标签:安装   values   not   print   fetch   tran   har   plain   启动   

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)

标签:安装   values   not   print   fetch   tran   har   plain   启动   

原文地址:https://www.cnblogs.com/adolfmc/p/12004701.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!