Skip to content

Allow Docker sandboxes to set container labels #4562

Closed

Description

@koadegno

Please read this first

  • Have you read the docs? Yes. I reviewed the sandbox client documentation and the current Docker sandbox implementation.
  • Have you searched for related issues? Yes. I searched open and closed issues and pull requests for Docker sandbox labels, container labels, DockerSandboxClientOptions labels, and Docker container metadata. I did not find an existing request covering this capability.

Describe the feature

I would like DockerSandboxClientOptions to support optional Docker container labels.

Docker labels are standard container metadata for identifying and managing containers with existing Docker tooling. The Docker Python SDK supports labels when creating a container, but DockerSandboxClient does not currently expose this option.

Proposed API:

DockerSandboxClientOptions(
    image="python:3.14-slim",
    labels={"com.example.owner": "worker-123"},
)

The option would be additive and optional. When omitted, Docker container creation would remain unchanged.

Labels would also be preserved in DockerSandboxSessionState so replacement containers created during resume() retain the configured metadata.

Activity

  1. seanxuu commented on Aug 21, 2026

    @seanxuu
    Contributor

    I’d like to work on this issue. I plan to add an optional labels mapping to DockerSandboxClientOptions, persist it in DockerSandboxSessionState, and forward it only when creating new or replacement containers. I’ll add focused coverage for Docker SDK keyword forwarding, options/state round-trips, and resume replacement behavior while keeping unlabeled containers unchanged.

  2. koadegno commented on Aug 21, 2026

    @koadegno
    ContributorAuthor

    Thanks for offering to work on this! I’ve already been working on an implementation for this issue and have the changes and test coverage ready on my fork. I’m doing the final review now and plan to open the PR shortly, so I’d like to avoid duplicating your work. I’ll link the PR here once it’s opened.

  3. seanxuu commented on Aug 21, 2026

    @seanxuu
    Contributor

    Thanks for offering to work on this! I’ve already been working on an implementation for this issue and have the changes and test coverage ready on my fork. I’m doing the final review now and plan to open the PR shortly, so I’d like to avoid duplicating your work. I’ll link the PR here once it’s opened.

    Could you help me to check my code? @koadegno

  4. changed the title [-][Sandbox] Allow Docker sandboxes to set container labels[/-] [+]Allow Docker sandboxes to set container labels[/+] on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions