Report this

What is the reason for this report?

How to run docker container in AMD GPU Droplet and get access to the GPU

Posted on July 13, 2025

I’m using Pytorch in a python program that is in a docker container. When I run it I cannot see the GPU or detect it. I’ve launched an AMD GPU Droplet that should have rocm already installed on host.

I’m running the container with docker run --device /dev/kfd --device /dev/dri --security-opt seccomp=unconfined



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hey!

What base image are you using in your container? If it’s not one of the official ROCm supported images (like rocm/pytorch), that might be part of the issue.

You’re already passing the right flags with --device=/dev/kfd and /dev/dri, but sometimes it still won’t detect the GPU unless the container has everything set up for ROCm.

Might also be worth running rocminfo or hipinfo inside the container to see if anything shows up at all.

If it’s still not working, could be something subtle with the setup. I’d suggest reaching out to DigitalOcean support at do.co/support. They might be able to confirm whether ROCm is fully set up and available for your Droplet.

- Bobby

Heya, @stevemcatee

If your container isn’t using a ROCm-ready base image (like rocm/pytorch or an Ubuntu image with ROCm installed), PyTorch won’t see the GPU. --device=/dev/kfd and /dev/dri are needed, but sometimes /dev/dri/renderD128 helps too. Always test with rocminfo or rocm-smi inside the container — if those don’t see the GPU, PyTorch won’t either.

If you’ve got the right base image and devices but it still fails, it’s worth checking with DigitalOcean support to confirm the host’s ROCm drivers are set up correctly for your Droplet type.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.