Skip to content

[Feature] Attach host volumes to container use (CWD + additional directories) #280

@luketych

Description

@luketych

Summary

Allow container use to mount one or more host directories (read-write or read-only) into the running container.

Primary need: mount the current working directory and a second directory that stores prompts/configurations for LLM tools (e.g., Claude, OpenCode) used inside the container.

Motivation

When iterating with LLM tooling inside a Dagger-managed container, I need:

The project CWD mounted (code in/out).

A separate prompts/configs directory mounted (shared across projects).

Optionally, additional read-only mounts for datasets or model caches.

Right now, accomplishing multi-mount workflows requires bespoke SDK code or external wrappers. Native support in container use would make it trivial to adopt and script, and would align with the “fast inner loop” developer workflow.

Proposal

Add repeated --mount flags to container use:

Read-write by default

dagger container use
--mount "$(pwd):/work"
--mount "$HOME/llm/prompts:/prompts"
--workdir /work

Read-only mount

dagger container use
--mount "$HOME/datasets:/data:ro"

Flag format:
--mount :[:ro|rw]

Use cases

Run Claude/OpenCode (or other LLM tools) inside a container with:

/work = project CWD

/prompts = shared library of prompts/configs

Share a model cache or dataset directory across multiple projects/containers.

Mount dotfiles or toolchains read-only (e.g., /opt/tooling:ro).

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