Closed SpangeJ closed 9 months ago
Hi @SpangeJ and thanks for your issue. I'm gonna cc in @p1-0tr who might be able to help.
Just a silly question from me, did you set up the nvidia container toolkit repository before installing? Otherwise I guess you might end up installing the deprecated container runtime. See here: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-with-apt
(Either way, we'll need to update these docs)
Hi, I'm pretty sure it will be down to the -runtime
(deprecated) vs -toolkit
issue. I'll try to set aside some time later today to test the examples on my system. Buy, yeah, we definitely will need to update the docs.
Hi @SpangeJ and thanks for your issue. I'm gonna cc in @p1-0tr who might be able to help.
Just a silly question from me, did you set up the nvidia container toolkit repository before installing? Otherwise I guess you might end up installing the deprecated container runtime. See here: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-with-apt
(Either way, we'll need to update these docs)
@dvdksn I can at least run nvidia-container-toolkit
NVIDIA Container Runtime Hook version 1.14.5
commit: 9ea336070134e612145d342e495f2fc616aab063
But I did not fully understand the Configuration part. Because
sudo systemctl restart docker
Failed to restart docker.service: Unit docker.service not found.
I use systemctl --user restart docker-desktop.service
to restart docker.
Same thing with Rootless
systemctl --user restart docker
Failed to restart docker.service: Unit docker.service not found.
Thanks for a swift reply.
Oh, @SpangeJ, sorry I missed the fact that you are using Docker Desktop, when looking at your report at first. Unfortunately in Docker Desktop GPUs are currently only supported on Windows with the WSL2 backend.
You can use GPUs with a native Docker Engine installation (docker-ce
) on Linux, though. To get the Docker Engine installed, please follow https://docs.docker.com/engine/install/ubuntu/ and then the configure step (I'm assuming you've still got the Nvidia toolkit installed) from https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installing-with-apt .
The Docker Engine and Docker Desktop can coexist, if you want to keep using DD for other usecases. To switch between them you can use docker context use <context name>
, DD creates a desktop-linux
context and the native engine should be accessible under the default
context (docker context ls
will list available contexts).
Sorry for the initial confusion. And thanks for your questions :)
@p1-0tr thank you for your reply, I do indeed use Docker Desktop.
E.G. I start it by running systemctl --user start docker-desktop
what confuses me is that you say that Docker Engine and Docker Desktop is not compatible and in the docs it says:
You can install Docker Engine in different ways, depending on your needs:
Docker Engine comes bundled with Docker Desktop for Linux This is the easiest and quickest way to get started.
Regardless, I did an Uninstall old versions, then downloaded the newest DEB and installed that.
I did docker context use default
to change from Desktop to Engine, and now I get a docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
when I do
docker run -it --rm --gpus all ubuntu nvidia-smi
I tried to follow the NVIDIA Configurations, although I do not know if I should choose Configuring Docker
or Rootless mode
(I'm thinking maybe the latter since I already use the --user
option with Docker Desktop). Regardless of the options when I run sudo systemctl restart docker
or systemctl --user restart docker
I get Failed to restart docker.service: Unit docker.service not found.
Any thoughts? Why is not docker.service existing?
@p1-0tr thank you for your reply, I do indeed use Docker Desktop. E.G. I start it by running
systemctl --user start docker-desktop
what confuses me is that you say that Docker Engine and Docker Desktop is not compatible and in the docs it says:
Yeah I can see how this can be confusing. In general Docker Desktop should be the simpler option to use. However, given that it uses a virtual machine to run the Docker Engine it manages, it has some constraints, one of them is not having access to devices (GPU's among them).
... then downloaded the newest DEB and installed that. ...
Do you mean you manually downloaded the DEB file and installed that?
... Regardless of the options when I run sudo systemctl restart docker or systemctl --user restart docker I get Failed to restart docker.service: Unit docker.service not found.
This sounds like setting up the systemd integration failed (or some other error was encountered during the installation). Could you follow the instructions for installing with apt?
... although I do not know if I should choose Configuring Docker or Rootless mode (I'm thinking maybe the latter since I already use the --user option with Docker Desktop). ...
If you followed the default instruction (e.g. the one I linked in the previous paragraph), sudo systemctl restart docker
should work. The Rootless mode
variant is there for cases where one can't install docker-ce
via the package manager, e.g. on IT managed systems where one does not have access to root, then you can follow https://docs.docker.com/engine/security/rootless/ (but in such cases you may need to ask your admin to configure access to the gpu device nodes).
@p1-0tr Yes, I installed the DEB file, following these instructions.
So I uninstalled again and followed the apt installation instructions. And finally! I can run docker run -it --rm --gpus all ubuntu nvidia-smi
getting that sweet proper output.
Running docker context use desktop-linux
followed by systemctl --user start docker-desktop
I am able to get my Docker Desktop GUI up and running.
Of course now, as expected, I get my old libnvidia-ml.so.1
error when I run docker run -it --rm --gpus all ubuntu nvidia-smi
.
Switching back using docker context use default
it works.
Looping back to why this issue was opened, GenAI application, I can now run docker compose up --build
.
Thank you for helping me resolving this issue, @p1-0tr and @dvdksn
With this comment I choose to close this issue, although I recommend Docker to add additional description about for Linux user using the --gpu
flag when they have installed Docker using th DEB package.
@SpangeJ - I'm glad things are working for you now :)
@p1-0tr Yes, I installed the DEB file, following these instructions.
Those are for installing Docker Desktop, which unfortunately currently does not work with GPUs (or other devices). We've amended the GenAI guide to clarify which is the right choice - Engine or Desktop - depending on the OS one is using, and whether one wants to take advantage of GPU acceleration.
Thanks for bringing the issue to our attention ! :)
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
/lifecycle locked
Is this a docs issue?
Type of issue
Information is incorrect
Description
I am trying to follow the guide on a generative AI, but it results in an error. So I went to the source on how to access an NVIDIA GPU (which I have), after successfully running
apt-get install nvidia-container-runtime
I try to rundocker run -it --rm --gpus all ubuntu nvidia-smi
, but I get the following error:Additional info about my system:
nvidia-container-cli -k -d /dev/tty info
uname -a
Linux kodeworks 6.5.0-17-generic #17~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 16 14:32:32 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
nvidia-smi -a
docker version
dpkg -l '*nvidia*'
nvidia-container-cli -V
Location
https://docs.docker.com/config/containers/resource_constraints/#gpu
Suggestion
I hope that the Docker Docs can be updated such that the procedures works on my machine, which I think is a quite common setup (Ubuntu + NVIDIA GPU)