Skip to content

feat: Add support for mounting devices#2845

Merged
tedim52 merged 13 commits intokurtosis-tech:mainfrom
dzobbe:main
Dec 11, 2025
Merged

feat: Add support for mounting devices#2845
tedim52 merged 13 commits intokurtosis-tech:mainfrom
dzobbe:main

Conversation

@dzobbe
Copy link
Copy Markdown
Contributor

@dzobbe dzobbe commented Nov 27, 2025

Description

This PR adds device support to the Docker backend, bringing feature parity with the Kubernetes backend. Previously, the devices field in ServiceConfig was only supported when running on Kubernetes. This change enables services running in Docker containers to access host devices (e.g., /dev/tpm0, /dev/gpu0, etc.).
It can be configured via an extended ethereum-package repo
https://github.com/ethpandaops/ethereum-package/pull/1251/files

Changes Made

  1. Added devices field to CreateAndStartContainerArgs and CreateAndStartContainerArgsBuilder in the Docker manager
  2. Added WithDevices() method to the builder pattern for setting device paths
  3. Updated getContainerHostConfig() to accept and process device paths, converting them to Docker's DeviceMapping format
  4. Added convertDevicesToDockerDeviceMapping() helper function that maps device paths to Docker's device format with read-write-mknod permissions
  5. Updated start_user_services.go to extract devices from service config and pass them through to the Docker container creation

How It Works

When a service config includes a devices list (e.g., devices = ["/dev/tpm0"]), the Docker backend now:

  • Extracts the device paths from the service config
  • Converts them to Docker's container.DeviceMapping format
  • Mounts each device with the same path in the container as on the host
  • Grants read-write-mknod permissions (rwm) to the container

Motivation

This change enables services that require access to host hardware devices (such as TPM chips for attestation, GPUs, or other specialized hardware) to function correctly when running in Docker-based Kurtosis enclaves. Previously, such services would fail with "device not found" errors even when the device was specified in the Starlark service config.

Example Usage

service_config = ServiceConfig(
name = "tpm-service",
image = "my-image",
devices = ["/dev/tpm0"], # Device is now accessible in Docker containers
# ... other config
)## REMINDER: Tag Reviewers, so they get notified to review

Is this change user facing?

YES

References (if applicable)

@dzobbe dzobbe changed the title Add support for mounting devices feat: Add support for mounting devices Nov 27, 2025
@barnabasbusa
Copy link
Copy Markdown
Collaborator

were you able to compile it locally?

Looks like the CI fails with build errors. Can you try to debug those?

@dzobbe
Copy link
Copy Markdown
Contributor Author

dzobbe commented Nov 28, 2025

Looks like now the checks have passed

@skylenet skylenet requested a review from tedim52 November 28, 2025 14:59
@tedim52
Copy link
Copy Markdown
Collaborator

tedim52 commented Nov 28, 2025

Thanks for the contribution @dzobbe !

Comment thread metrics-library/golang/go.mod Outdated
Comment thread container-engine-lib/lib/backend_interface/objects/service/service_config.go Outdated
Copy link
Copy Markdown
Collaborator

@tedim52 tedim52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few minor comments.

@dzobbe
Copy link
Copy Markdown
Contributor Author

dzobbe commented Dec 2, 2025

I think I addressed the comments

@tedim52 tedim52 added this pull request to the merge queue Dec 11, 2025
Merged via the queue into kurtosis-tech:main with commit 78a237f Dec 11, 2025
49 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Dec 11, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.14.0](1.13.2...1.14.0)
(2025-12-11)


### Features

* Add support for mounting devices
([#2845](#2845))
([78a237f](78a237f))


### Bug Fixes

* print error in non interactive termianl
([#2850](#2850))
([5c33359](5c33359))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants