Skip to content

Instantly share code, notes, and snippets.

@Holt59
Created Mar 19, 2019
Embed
What would you like to do?
Dockerfile for AI Crowd Unity Obstacle Tower challenge
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"]
@Holt59
Copy link
Author

Holt59 commented Mar 19, 2019

Some comments on this:

I made this Dockerfile to get a faster build than the default aicrowd-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 — A pip requirement file. I would advise againt generating this file with pip 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:

  • /home/aicrowd
    • data
    • ObstacleTower
    • ...

Where ... are all the files within src (run.sh, env.sh, run.py, ...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment