├── helper_scripts └── run_container.sh ├── run_jupyter.sh ├── LICENSE ├── README.md └── Dockerfile.gpu /helper_scripts/run_container.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | CONTAINER="docker run -it --ipc=host --net=host -v ~/docker_files/:/ds hamelsmu/ml-gpu" 3 | echo 'Starting container with commmand: '$CONTAINER 4 | eval $CONTAINER 5 | -------------------------------------------------------------------------------- /run_jupyter.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | port=$1 3 | pass=$2 4 | 5 | if [[ $# -ne 2 ]] ; then 6 | echo 'ERROR: Usage: run_jupyter port password' 7 | echo 'Example: run_jupyter 8888 mypass' 8 | exit 0 9 | fi 10 | 11 | CMD="jupyter notebook --no-browser --allow-root --port=$port --NotebookApp.token='$pass'" 12 | echo 'Starting jupyter notebook server with commmand: '$CMD 13 | eval $CMD 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Hamel Husain 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub license](https://img.shields.io/github/license/hamelsmu/docker-gpu.svg)](https://github.com/hamelsmu/docker-gpu/blob/master/LICENSE) 2 | ![Docker Build Status](https://img.shields.io/docker/build/hamelsmu/ml-gpu.svg) 3 | ![Docker Automated build](https://img.shields.io/docker/automated/hamelsmu/ml-gpu.svg) 4 | ![Docker Pulls](https://img.shields.io/docker/pulls/hamelsmu/ml-gpu.svg) 5 | 6 | 7 | ### Docker image for machine learning on GPUs (deep learning) 8 | 9 | This repo is linked to the DockerHub repo: [hamelsmu/ml-gpu](https://hub.docker.com/r/hamelsmu/ml-gpu/). Any changes to this repository will automatically trigger a new build of the docker image on DockerHub. 10 | 11 | - **Some Notes About This Docker Image** 12 | 13 | - Built using [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) 14 | - [Helper scripts](https://github.com/hamelsmu/docker-gpu/tree/master/gpu) commands to run containers. 15 | 16 | 17 | 18 | ### Useful commands to remember: 19 | 20 | See all running containers: 21 | 22 | `docker ps -a -f status=running` 23 | 24 | 25 | Run terminal attached to a running container: 26 | 27 | `docker exec -it bash` 28 | 29 | Save state of container 30 | 31 | `docker commit new_image_name:tag_name(optional)` 32 | 33 | 34 | **More Resources** 35 | See [this tutorial](https://towardsdatascience.com/how-docker-can-help-you-become-a-more-effective-data-scientist-7fc048ef91d5) 36 | -------------------------------------------------------------------------------- /Dockerfile.gpu: -------------------------------------------------------------------------------- 1 | FROM tensorflow/tensorflow:latest-gpu-py3 2 | ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 3 | 4 | RUN add-apt-repository ppa:git-core/ppa 5 | 6 | RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificates \ 7 | build-essential \ 8 | byobu \ 9 | ca-certificates \ 10 | git-core git \ 11 | htop \ 12 | libglib2.0-0 \ 13 | libjpeg-dev \ 14 | libpng-dev \ 15 | libxext6 \ 16 | libsm6 \ 17 | libxrender1 \ 18 | libcupti-dev \ 19 | openssh-server \ 20 | software-properties-common \ 21 | vim \ 22 | && \ 23 | apt-get clean && \ 24 | rm -rf /var/lib/apt/lists/* 25 | 26 | #################### Install Anaconda 27 | # Why Anaconda? Its recommended Package Manager For PyTorch 28 | # The following section is from https://hub.docker.com/r/continuumio/anaconda3/~/dockerfile/ 29 | # You may have to check this periodically and update 30 | 31 | RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ 32 | wget --quiet https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh -O ~/anaconda.sh && \ 33 | /bin/bash ~/anaconda.sh -b -p /opt/conda && \ 34 | rm ~/anaconda.sh 35 | 36 | ENV PATH /opt/conda/bin:$PATH 37 | ################## 38 | 39 | # Install Pytorch Instructions at http://pytorch.org/ 40 | RUN conda install -y pytorch torchvision cuda90 -c pytorch 41 | RUN conda install -y opencv 42 | 43 | # Install Python packages 44 | RUN pip --no-cache-dir install --upgrade \ 45 | altair \ 46 | annoy \ 47 | bcolz \ 48 | dask \ 49 | fastai \ 50 | gensim \ 51 | graphviz \ 52 | h5py \ 53 | hdfs \ 54 | isoweek \ 55 | jsonpath_rw_ext \ 56 | jupyter_contrib_nbextensions \ 57 | jupyterthemes \ 58 | tensorflow-gpu \ 59 | keras \ 60 | ktext \ 61 | more_itertools \ 62 | nmslib \ 63 | pandas_summary \ 64 | Pillow \ 65 | pyhive \ 66 | spacy \ 67 | sklearn_pandas \ 68 | textacy \ 69 | torchtext \ 70 | tqdm \ 71 | wget 72 | 73 | #For Fairseq-py 74 | ENV NVIDIA_VISIBLE_DEVICES all 75 | ENV NVIDIA_DRIVER_CAPABILITIES compute,utility 76 | ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64 77 | RUN echo 'export PATH="/opt/conda/bin/:$PATH"' >> ~/.bashrc 78 | 79 | # Open Ports for TensorBoard, Jupyter, and SSH 80 | EXPOSE 6006 81 | EXPOSE 7654 82 | EXPOSE 22 83 | 84 | #Setup File System 85 | RUN mkdir ds 86 | ENV HOME=/ds 87 | ENV SHELL=/bin/bash 88 | VOLUME /ds 89 | WORKDIR /ds 90 | ADD run_jupyter.sh /ds/run_jupyter.sh 91 | RUN chmod +x /ds/run_jupyter.sh 92 | 93 | # Run the shell 94 | CMD [ "/bin/bash" ] 95 | --------------------------------------------------------------------------------