Setting up CUDA with docker meets the permission not granted problem - docker

I would like to setup cuda using the following code:
docker run -ti --rm --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 nvidia/cuda
I Kept getting these Errors:
Command 'docker' not found, but can be installed with:
snap install docker # version 18.06.1-ce, or
apt install docker.io # version 18.09.7-0ubuntu1~19.04.5
See 'snap info docker' for additional versions.
I tried to google these Errors, but failed.
System Environment: Ubuntu Desktop 19.04
I should explain that this is a clean System I'm currently using.

I should tell you one thing that, installing anything with docker comes with a prerequisite, which is that you should install docker first.
You can find the tutorials on how you could install docker in the following link:
How to install Docker
And then you could install Nvidia compiled docker container with the following command:
docker pull nvidia/cuda
docker run -ti --rm --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 nvidia/cuda
which was referenced from Nvidia CUDA Docker Hub and Nvidia CUDA GitHub page

Related

RAPIDS.ai dependencies cuml and cudf not found no matter how I install

I have followed every version of the instructions on the AWS-EC2 setup for RAPIDS.ai: https://rapids.ai/cloud#AWS-EC2
I can confirm that I am using the exact instance type in the instructions, and following the steps exactly.
When I try to use the docker approach, the --gpus all command is not accepted.
When I try to use the conda approach, the install fails with the error:
PackageNotFoundError: Packages missing in current channels:
- glibc
I have tried (many) different solutions provided to solve both of these problems, none of them seem to work. I really just need to test some python code with cuml and cudf imports in a notebook. Been at this for 7 hours (after giving up on my local and SageMaker).
You note that the --gpus all command is not accepted, which suggests that you do not have the NVIDIA Docker runtime installed.
I followed the instructions you linked and I did run into an issue where the sudo yum install -y nvidia-docker2 command failed and I needed to disable an Amazon yum repo that was causing come conflicts as outlined in this issue.
$ sudo yum-config-manager --disable amzn2-graphics
$ sudo yum install -y nvidia-docker2
$ sudo yum-config-manager --enable amzn2-graphics
Once I'd done that and run sudo systemctl restart docker I was able to start the RAPIDS container.
$ docker run --gpus all --rm -it -p 8888:8888 -p 8787:8787 -p 8786:8786 rapidsai/rapidsai:cuda11.2-runtime-ubuntu18.04-py3.7
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.download.nvidia.com/licenses/NVIDIA_Deep_Learning_Container_License.pdf
A JupyterLab server has been started!
To access it, visit http://localhost:8888 on your host machine.
Ensure the following arguments were added to "docker run" to expose the JupyterLab server to your host machine:
-p 8888:8888 -p 8787:8787 -p 8786:8786
Make local folders visible by bind mounting to /rapids/notebooks/host
(rapids) root#be7253bb4fdb:/rapids/notebooks#
Turns out, the frist AMI suggested in the documentation is not compatible. Use the Deep Learning NVIDIA one instead.

can't run docker in ubuntu 20.04

I had tried to install docker like I read in lots of site with the same steps, but it didn't work and always send me that error massage:docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. and I didn't could find solution that work.
After that I tried to test a bit the sudo snap, and I was surprised to discover that I can install docker using sudo snap install docker and its look like it worked, but when I run the sudo docker run -dt centos bash, I had got the same error.
It's not only a issue with CentOS, I had tried this with kali, mint, ubuntu, and fedora, no one of them worked, and the error is always the same/
thanks for help.
You need to mount /var/run/docker.sock
sudo docker run -dt -v /var/run/docker.sock:/var/run/docker.sock centos bash

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]

I saw similar treads but they are different because I am using WSL2 and docker and GPU aware docker.
I have windows 10 version 2004 (build 20161.1000)
I have installed WSL 2 and have Docker Desktop 2.3.0.3 on my Windows System running.
I have Ubuntu 18.04 LTS installed in WSL 2 too.
I have installed the NVIDIA driver
The linux version is 4.19.121-microsoft-standard.
The NVIDIA driver version is 455.41 for my Laptop GPU QUADRO M2000M.
Actually I followed all the steps described in https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2 until the step where I have to run "sudo service docker stop" in an Ubuntu terminal.
This results in a message docker: unrecognized service.
I have to restart docker desktop in WIndows 10 in order to get the deamon running.
I test then in the Ubuntu terminal : docker run hello-world ==> this runs fine
Also the command docker run -it ubuntu bash ==> runs file in the Ubuntu terminal os WSL 2.
BUT when I run :
docker run -u $(id -u):$(id -g) -it --gpus all -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3-jupyter
then I get the error : docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]]
This invoves microsoft,Ubuntu,NVIDIA. I have search the support sites but could not find anything that solves my prblem.
Can anyone help me here?
There is this strange answer mentioned here and here:
sudo service docker start
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
This worked for me on WSL (Ubuntu 20.04), so I added it to the ~/.bashrc script.
Note, the first part may need to be restarting docker!

Linking graphic card in Docker via OpenCL

I am on Ubuntu 19.10. and would like to use OpenCL inside docker.
Inside of the docker container I have installed opencl-headers,ocl-icd-opencl-dev and clinfo.
When I run clinfo on my machine outside of docker I have following response:
Number of platforms 1
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Version OpenCL 1.2 CUDA 10.2.159
...
When same is run in docker:
Number of platforms 0
I thought docker container should be able to use my graphic card, but am unsure if/how I should allow it.
Thank you for some insights
You need to start docker with the --gpus all option, eg:
docker run --rm --gpus all nvidia/opencl clinfo
You can also expose just a specific gpu:
docker run -it --rm --gpus "device=0" ubuntu nvidia-smi
Read more here: https://docs.docker.com/config/containers/resource_constraints/
If you get this error:
$ docker run --rm --gpus all nvidia/opencl clinfo
docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].
On Ubuntu, you can remedy it with:
$ sudo apt install -y nvidia-container-toolkit; sudo systemctl restart docker

how to install docker in sles 12?

I want to install docker stable version in my suse system (version sles 12). For installing docker in suse system, need to add repository of docker.
I didn't found any url (repository url) for adding docker repository of version 1.6. I found docker version 1.12 but it is not working in my case. I removed docker repository now.
can anyone suggest me how I can add correct repository and install docker further in my system?
edit- sample commands and output
docker -v
Docker version 1.6.0, build 4749651
docker pull hello-world
FATA[0000] Cannot connect to the Docker daemon. Is 'docker -d' running on this host?
sudo docker pull hello-world
sudo: docker: command not found
You can use zypper to do that.
You have to adapt the repository url to your SUSE version. To find the correct package repository, please follow this link
https://software.opensuse.org/download.html?project=Virtualization%3Acontainers&package=docker
sudo zypper addrepo https://download.opensuse.org/repositories/Virtualization:containers/openSUSE_Leap_15.0/Virtualization:containers.repo
sudo zypper dist-upgrade
sudo zypper update
sudo zypper install docker
Source : https://w3blog.fr/en/2019/03/25/install-docker-open-source-on-linux-suse/
You will find Docker 1.6 at
https://get.docker.com/builds/Linux/x86_64/docker-1.6.0.tgz
The general doc for installing docker in Suse is available at
https://docs.docker.com/engine/installation/linux/SUSE/

Resources