Wednesday, 30 March 2022

how to build a conda docker with nvidia driver?

Dockerfile

----------------------

FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu18.04

MAINTAINER Anna Shcherbina <annashch@stanford.edu>

#
# Install Miniconda in /opt/conda
#

ENV PATH /opt/conda/bin:$PATH

RUN apt-get update --fix-missing && \
    apt-get install -y wget bzip2 ca-certificates curl git && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-py39_4.11.0-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

ENV PATH /opt/conda/bin:$PATH
ENV LD_LIBRARY_PATH /usr/local/cuda-10.2/lib64:/usr/local/cuda-10.2/extras/CUPTI/lib64:$LD_LIBRARY_PATH


how to build it

----------------------

docker build -t conda_docker:ninja_v1p00 .


how to run it

----------------------

docker run --shm-size=1g --ulimit memlock=-1 --ulimit stack=67108864  --rm --runtime nvidia  --net=host  --ipc=host --security-opt apparmor:unconfined  -e DISPLAY=$DISPLAY -v /home/ninja/temp:/workspace -v /home/ninja/output/:/output/ -v /etc/localtime:/etc/localtime:ro -it -w /data/ --entrypoint="/bin/bash" conda_docker:ninja_v1p00



 

No comments:

Post a Comment