I'm trying to setup a docker container for some ML work, for which I need CUDA and Conda. I setup the docker image with this command:
docker run -it continuumio/anaconda3:2020.11
In order to setup CUDA, I am following these instructions.
The steps in the link are:
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-debian11-11-8-local_11.8.0-520.61.05-1_amd64.deb
dpkg -i cuda-repo-debian11-11-8-local_11.8.0-520.61.05-1_amd64.deb
cp /var/cuda-repo-debian11-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
add-apt-repository contrib
apt-get update
apt-get -y install cuda
However, the steps fail when trying to run add-apt-repository contrib
. Based on other threads, I've tried:
apt-get install software-properties-common
however, that fails as well:
E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/systemd_241-7~deb10u4_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/systemd-sysv_241-7~deb10u4_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/libpython3.7-minimal_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/python3.7-minimal_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/python3.7/libpython3.7-stdlib_3.7.3-2+deb10u2_amd64.deb 404 Not Found [IP: 146.75.94.132 80]
...
How do I get this installed?
I suggest that you build a derived image which wraps up both Anaconda and CUDA. There seem to be two obvious approaches:
Based on a bit of experimentation the second approach appears to be better.
FROM nvidia/cuda:11.8.0-base-ubuntu22.04
RUN apt-get update && apt-get install -y wget && \
wget -q https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh && \
bash Anaconda3-2020.11-Linux-x86_64.sh -b && \
rm Anaconda3-2020.11-Linux-x86_64.sh
ENV PATH /root/anaconda3/bin:$PATH
# Python packages for testing.
#
RUN conda install -y -q numba cudatoolkit
Assuming you are on a machine with an NVIDIA GPU and you have the drivers installed you can test the connection to the GPU. You need to run the image with the --gpus all
option.