-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathdockerfile_cn
87 lines (80 loc) · 4.22 KB
/
dockerfile_cn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu16.04
LABEL maintainer="StepNeverStop(Keavnn)"\
github="https://github.com/StepNeverStop/RLs"\
description="Docker image for runing RLs."\
rls_version="5.0.0"\
email="[email protected]"
ENV LANG C.UTF-8
# change sources and install apt packages
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && echo "\
deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted\n\
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted\n\
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial universe\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse\n\
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties\n\
deb http://archive.canonical.com/ubuntu xenial partner\n\
deb-src http://archive.canonical.com/ubuntu xenial partner\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted\n\
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe\n\
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse" > /etc/apt/sources.list && \
mv /etc/apt/sources.list.d/cuda.list /etc/apt/sources.list.d/nvidia-ml.list /tmp && \
apt-get upgrade && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
apt-get update --fix-missing && \
apt-get install -y apt-file apt-utils nano --no-install-recommends wget bzip2 ca-certificates curl git openssh-server \
libglib2.0-dev libsm6 libxrender1 libxext6 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
mkdir /var/run/sshd && \
echo "root:1234" | chpasswd && \
sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config && \
sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed 's@session\srequired\spam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
# install miniconda3 and change source of pip
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \
. /opt/conda/etc/profile.d/conda.sh && \
conda init bash && \
echo "\
channels:\n\
- http://mirrors.ustc.edu.cn/anaconda/pkgs/main/\n\
- http://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/\n\
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/\n\
- defaults" > ~/.condarc && \
conda update conda && \
conda install -y conda-build && \
/opt/conda/bin/conda build purge-all && \
mkdir -p ~/.pip && \
echo "\
[global]\n\
index-url = http://mirrors.aliyun.com/pypi/simple/\n\
[install]\n\
trusted-host = mirrors.aliyun.com" > ~/.pip/pip.conf
# install my own conda environment
RUN . /opt/conda/etc/profile.d/conda.sh && \
conda create -n rls python=3.8 && \
conda activate rls && \
echo -e "\033[4;41;32m conda activate rls successed. \033[0m" && \
cd ~ && git clone https://github.com/StepNeverStop/RLs.git && cd RLs && \
pip install -e . && \
/opt/conda/bin/conda build purge-all && \
rm -rf ~/.cache/pip/* && \
python run.py -p gym -a dqn -c 4 -t 10000 && \
echo -e "\033[4;41;32m run rls successed. \033[0m"
# 22:ssh 6006:tensorboard 8888:jupyter lab
EXPOSE 22 6006 8888
ENTRYPOINT ["/usr/sbin/sshd","-D"]