Skip to content

Default value for Container arguments #8483

Closed

Description

@shykes

Problem

When my function receives a container as argument, I can't set a default value for it. The way the CLI accepts a string value for container arguments, and interprets it as a remote Container.from() pipeline, could be used in the same way here. But it's not.

I would expect this to work:

func Foo(
  // +optional
  // +default="alpine:latest"
  c *dagger.Container,
)

But it doesn't.

Solution

Make the above example work :)

Activity

  1. Transmitt0r commented on Sep 18, 2024

    @Transmitt0r

    Same for Directory in 0.13.0 Go SDK

  2. marcosnils commented on Sep 18, 2024

    @marcosnils
    Contributor

    Same for Directory in 0.13.0 Go SDK

    You can do this with directories by following using another defaultPath argument documented here: https://docs.dagger.io/manuals/developer/functions/#directories-and-files

  3. tiborvass commented on Sep 18, 2024

    @tiborvass
    Contributor

    👋 I can tackle this one.

  4. Transmitt0r commented on Sep 18, 2024

    @Transmitt0r
  5. shykes commented on Dec 6, 2024

    @shykes
    ContributorAuthor

    @tiborvass do you still want to do this one? No problem if not, I'll just unassign and queue it up

  6. jasonmccallister commented on Mar 28, 2025

    @jasonmccallister
    Contributor

    Would be nice to also set a default value for a *dagger.Service 🙏

  7. jedevc commented on Aug 21, 2025

    @jedevc
    Contributor

    x-linking #10770, which should be the way to unify all of this.

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