Last active
July 17, 2019 10:13
-
-
Save anhtranbk/c5197a8e3dfeee8618c4f19e664a696c to your computer and use it in GitHub Desktop.
Dockerfile for OpenSSH + Anaconda3 with Jupyter at startup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
ai4dev: | |
image: ai4dev | |
container_name: ai4dev | |
build: . | |
restart: always | |
ports: | |
- "8022:22" | |
volumes: | |
- ./data:/data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
RUN apt-get update -y | |
RUN apt-get install -y openssh-server wget bzip2 htop net-tools tmux | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:admin!2346' | chpasswd | |
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
# SSH login fix. Otherwise user is kicked off after login | |
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd | |
ENV NOTVISIBLE "in users profile" | |
RUN echo "export VISIBLE=now" >> /etc/profile | |
RUN systemctl enable ssh | |
RUN service ssh start | |
# Install data science packages | |
WORKDIR /root | |
RUN wget https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh | |
RUN bash Anaconda3-*.sh -b | |
RUN rm -f Anaconda3-*.sh | |
# Set path to conda | |
ENV PATH /root/anaconda3/bin:$PATH | |
# Updating Anaconda packages | |
RUN conda update conda | |
RUN conda update anaconda | |
RUN conda update --all | |
RUN conda init | |
# Configuring access to Jupyter | |
RUN jupyter notebook --generate-config --allow-root | |
RUN echo "c.NotebookApp.password = u'sha1:6a3f528eec40:6e896b6e4828f525a6e20e5411cd1c8075d68619'" >> /root/.jupyter/jupyter_notebook_config.py | |
# Install some util packages | |
RUN apt-get install -y gcc g++ git screen curl | |
# Run SSH server as Docker main process | |
CMD ["/usr/sbin/sshd", "-D"] | |
# Run Jupyter notebook as Docker main process | |
# CMD ["jupyter", "notebook", "--allow-root", "--notebook-dir=/data", "--ip='0.0.0.0'", "--port=8888", "--no-browser"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment