Skip to content

Sharing GPU between Docker containers #1534

@AvinashKushwah

Description

@AvinashKushwah

I am running multiple Docker containers using the following command, which exposes all GPU devices to each container:

sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

Scenario:

Container C1 runs Process P1, which internally needs to use GPU IDs 1, 2, 3, and 4.

Container C2 runs Process P2 at the same time.

Since both containers receive access to all GPU devices, I want to understand the expected behavior:

Question

Is it possible that P2 in C2 also selects GPUs 1, 2, 3, and 4, leading to GPU resource contention, crashes, or failed inference/training runs?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions