FROM nvidia/cuda:10.2-base-ubuntu18.04 # Install some basic utilities RUN apt-get update && apt-get install -y \ curl \ ca-certificates \ sudo \ git \ bzip2 \ libx11-6 \ python3.8 \ python3-pip \ && apt autoclean && apt autoremove \ && rm -rf /var/lib/apt/lists /var/cache/apt/archives RUN alias pip=pip3 python=python3.8 RUN pip install --no-cache-dir torch opencv-python RUN rm -rf ~/.cache/pip/* # Create a working directory RUN mkdir /app WORKDIR /app # Create a non-root user and switch to it RUN adduser --disabled-password --gecos '' --shell /bin/bash user \ && chown -R user:user /app RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user USER user # All users can use /home/user as their home directory ENV HOME=/home/user RUN chmod 777 /home/user # Set the default command to python3 ENTRYPOINT [ "bash" ]