Docker unlimited resources

docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 -it --rm --privileged --detach-keys "ctrl-a,a" -v $(pwd):/workspace <image-name>

Map detach-keys to something else

The default detach shortcut is ctrl-p, ctrl-q conflicting the previous command ctrl-p. Adding the option --detach-keys "ctrl-a,a" maps it to something else.

Port forwarding

-p 9999:9999

Use Host DNS

--dns-opt=/etc/resolv.conf

Podman Container Device Interface (CDI)

From NVIDIA ref

sudo dnf clean expire-cache \
    && sudo dnf install -y nvidia-container-toolkit-base
sudo nvidia-ctk cdi generate --output=/etc/cdi/nvidia.yaml
grep "  name:" /etc/cdi/nvidia.yaml

It should show the GPU device ids (this example is for two gpus):

  name: "0"
  name: "1"
  name: all

Then, we can choose which GPU (using 0 or 1 or all) to run the container:

podman run --rm -u sync -it -v $(pwd):/workspace  --device nvidia.com/gpu=0 <image-name>