Created
March 19, 2019 17:12
-
-
Save Holt59/b6068da26dd51210277f762b7166efa2 to your computer and use it in GitHub Desktop.
Dockerfile for AI Crowd Unity Obstacle Tower challenge
This file contains 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 nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04 | |
# avoid prompts from apt | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update -qq && \ | |
apt-get install -qq --yes --no-install-recommends \ | |
software-properties-common | |
# Set up locales properly | |
RUN add-apt-repository ppa:deadsnakes/ppa && \ | |
apt-get update -qq && \ | |
apt-get install -qq --yes --no-install-recommends \ | |
python3.6 python3-pip python3-setuptools \ | |
libxrender1 locales wget bzip2 curl git xvfb ffmpeg && \ | |
apt-get purge -qq && \ | |
apt-get clean -qq && \ | |
rm -rf /var/lib/apt/lists/* | |
RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ | |
locale-gen | |
ENV LC_ALL en_US.UTF-8 | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US.UTF-8 | |
# Use bash as default shell, rather than sh | |
ENV SHELL /bin/bash | |
COPY ./requirements.txt /requirements.txt | |
RUN python3.6 -m pip install --upgrade pip && \ | |
python3.6 -m pip install -r /requirements.txt | |
# Set up user | |
ARG NB_USER | |
ARG NB_UID | |
ENV USER ${NB_USER} | |
ENV HOME /home/${NB_USER} | |
RUN adduser --disabled-password \ | |
--gecos "Default user" \ | |
--uid ${NB_UID} \ | |
${NB_USER} | |
WORKDIR ${HOME} | |
EXPOSE 8888 | |
# Copy and chown stuff. | |
USER root | |
COPY ObstacleTower ${HOME}/ObstacleTower | |
COPY data/ ${HOME}/data | |
COPY src ${HOME}/ | |
RUN chown -R ${NB_USER}:${NB_USER} ${HOME} | |
USER ${NB_USER} | |
# We always want containers to run as non-root | |
USER ${NB_USER} | |
# Specify the default command to run | |
CMD ["jupyter", "notebook", "--ip", "0.0.0.0"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some comments on this:
I made this
Dockerfile
to get a faster build than the defaultaicrowd-repo2docker
build, and to avoid most of the build process when only some sources in my repository change.This
Dockerfile
is specific to python 3.6, although it should be possible to make it work for other python versions. This should be built with the following files / folder:requirements.txt
— Apip
requirement file. I would advise againt generating this file withpip freeze
since it generates version specific requirements, and some of them will not work. Typically, only tensorflow < 1.12 will work with this container due to the CUDA version.ObstacleTower
— The folder containing the obstacle tower executable.data
— A folder containing data (e.g., checkpoints).src
— Folder containing the source files.Within the docker, the
$HOME
will looks like:Where
...
are all the files withinsrc
(run.sh
,env.sh
,run.py
, ...).