#查看主机信息
neofetch
#切换root用户,接下来的命令用root用户好操作
sudo su
#查看docker在线下载源
docker info
#配置docker在线下载源
vi /etc/docker/daemon.json
{
"registry-mirrors":[
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com",
"https://docker.mirrrors.ustc.edu.cn"
]
}
输入以上内容,保存退出,重启docker
service docker restart
#查看docker状态
systemctl status docker
#启动docker
systemctl start docker
#搜索alpine镜像
docker search alpine
#下载镜像
docker pull alpine
#查看镜像
docker images
#创建共享目录,可递归创建文件夹(-p)
mkdir -p /xx/mount
#根据alpine镜像来创建容器
docker create -it --name myalpine -h alpine --privileged=true -v /xx/mount:/xx/mount -p 9085:9085 alpine:latest /sbin/init
#查看创建的容器
docker ps -a
#启动容器
docker start myalpine
#查看运行的容器
docker ps
#进入docker容器内
docker exec -it myalpine /bin/sh
#alpine更换国内下载源
vi /etc/apk/repositories //源配置文件
https://mirrors.ustc.edu.cn/alpine/latest-stable/main
https://mirrors.ustc.edu.cn/alpine/latest-stable/community //注释旧源,写入新源
apk update //更新新源
#安装python及各种依赖
apk add python3 python3-dev gcc openssl-dev openssl libressl libc-dev linux-headers libffi-dev libxml2-dev libxml2 libxslt-dev g++
python3:安装Python3;
python3-dev:安装Python3开发工具;
gcc:安装GNU编译器;
openssl-dev:安装OpenSSL开发库;
openssl:安装OpenSSL库;
libressl:安装LibreSSL库;
libc-dev:安装C语言开发工具;
linux-headers:安装Linux内核头文件;
libffi-dev:安装Foreign Function Interface库的开发工具;
libxml2-dev:安装XML开发库;
libxml2:安装XML库;
libxslt-dev:安装Libxslt库的开发工具;
g++:安装C++编译器。
#更改pip下载源为国内源
vi /home/.pip/pip.conf
[global]
timeout=60
index-url=http://pypi.douban.com/simple
extra-index-url=http://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple/
http://pypi.mirrors.ustc.edu.cn/simple/
[install]
trusted-host=pypi.douban.com
mirrors.aliyun.com
pypi.tuna.tsinghua.edu.cn
pypi.mirrors.ustc.edu.cn
[freeze]
timeout = 10
#清除pip缓存,刷新下载源
pip cache purge
#查看当前pip下载源
pip config get global.index-url
#安装jupyter
pip3 install jupyter
#生成配置文件
jupyter notebook --generate-config
默认/home/.jupyter会生成三个文件
jupyter_notebook_config.py
migrated
nbconfig
#安装jupyter扩展,进行全局安装(--sys-prefix)
pip install jupyter_contrib_nbextensions && jupyter contrib nbextension install --sys-prefix
#启动jupyter服务,指定根目录,允许root身份运行,输出日志,后台运行
jupyter notebook --notebook-dir=/xx/mount --allow-root > /xx/mount/jupyter.log 2>&1 &
#查看jupyter进程
pgrep jupyter
#杀死jupyter进程
pkill -9 jupyter
#退出docker主机,进入物理机
exit
#进入docker容器挂载的文件夹
cd /xx/mount
#git从远程仓库克隆到本地
git clone https://<TOKEN>@github.com/<user_name>/<repo_name>.git
#创建git令牌
首先,打开 GitHub 在任意页面的右上角,单击个人头像,然后依次点击 Settings(设置)--> Developer settings(开发者设置) --> Personal access tokens(个人访问令牌)--> Generate new token(生成新令牌),选择要授予此令牌的作用域或权限。如果要使用令牌从命令行访问仓库,请勾选 repo(仓库)单击 Generate token(生成令牌)。详细参考 -> 创建个人访问令牌
#恢复文件夹
git checkout master
#个人jupyter扩展选项
#浏览器打开jupyter的.ipynb格式文件展示效果