Skip to content

Instantly share code, notes, and snippets.

@zyzsdy
Created September 13, 2018 12:20
Show Gist options
  • Save zyzsdy/d2946382ff51b635102928ba7d1401e4 to your computer and use it in GitHub Desktop.
Save zyzsdy/d2946382ff51b635102928ba7d1401e4 to your computer and use it in GitHub Desktop.
上海大学机器学习平台 Tensorflow Docker 快速构建教程

上海大学机器学习平台 Tensorflow Docker 快速构建教程

Step 1. 准备本地Docker环境

虽然镜像本身的确是Ubuntu,但是构建环境不是必须在Linux上,Win版的docker也可以,但是必须Win10 pro以上。

Step 2. 修改Dockerfile文件

随你自己喜欢的方式来改。

Step 3. 通过Dockerfile建立镜像

docker build -t hub.hoc.ccshu.net/【仓库名】/【镜像名】:【镜像版本】 .

仔细看,最后有个点的!

Step 4. 上传镜像

docker login hub.hoc.ccshu.net
docker push hub.hoc.ccshu.net/【仓库名】/【镜像名】:【镜像版本】

完了!

备注

如果需要挂代理,给vpnkit.exe代理。(当然你可以选择全局)

# Refer: github.com/ufoym/deepo
FROM nvidia/cuda:9.0-cudnn7-devel-ubuntu16.04
RUN rm -rf /var/lib/apt/lists/* \
/etc/apt/sources.list.d/cuda.list \
/etc/apt/sources.list.d/nvidia-ml.list && \
#
# BASIC TOOLS
#
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake wget git vim && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
python3.6 python3.6-dev && \
wget -O ~/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
python3.6 ~/get-pip.py && \
ln -s /usr/bin/python3.6 /usr/local/bin/python3 && \
ln -s /usr/bin/python3.6 /usr/local/bin/python && \
#
# PIP MODULES
#
python -m pip --no-cache-dir install --upgrade \
setuptools && \
python -m pip --no-cache-dir install --upgrade \
numpy scipy pandas scikit-learn matplotlib ipython nltk && \
python -m pip --no-cache-dir install --upgrade \
tensorflow-gpu && \
#
# SSH SERVER
#
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
openssh-server && \
mkdir /var/run/sshd && \
echo "root:shuwsc910" | chpasswd && \
sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config && \
#
# CLEANUP
#
ldconfig && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/list/* /tmp/* ~/*
ENTRYPOINT ["/usr/sbin/sshd", "-D"]
EXPOSE 22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment