Dagger GraphQL API Reference

Queries

cacheVolume

Description

Constructs a cache volume for a given cache key.

Arguments
Name Description
key - String! A string identifier to target this cache volume (e.g., "modules-cache").
Example
query {
  cacheVolume(key: "deps") {
    id
  }
}

Try it in the API Playground!

container

Description

Loads a container from ID.

Null ID returns an empty container (scratch). Optional platform argument initializes new containers to execute and publish as that platform. Platform defaults to that of the builder's host.

Type

Container!

Arguments
Name Description
id - ContainerID
platform - Platform
Example
query {
  container {
    from(address: "alpine") {
      defaultArgs
      entrypoint
      platform
      rootfs {
        entries
      }
    }
  }
}

Try it in the API Playground!

defaultPlatform

Description

The default platform of the builder.

Type

Platform!

Example
query {
  defaultPlatform
}

Try it in the API Playground!

directory

Description

Load a directory by ID. No argument produces an empty directory.

Type

Directory!

Arguments
Name Description
id - DirectoryID
Example
query {
  directory {
    withNewDirectory(path: "foo") {
      withNewDirectory(path: "foo/bar/baz") {
        withNewFile(path: "foo/bar/greeting", contents: "hello, world!\n") {
            foo: entries(path: "foo")
          bar: entries(path: "foo/bar")
          greeting: file(path: "foo/bar/greeting") {
            contents
          }
        }
      }
    }
  }
}

Try it in the API Playground!

file

Description

Loads a file by ID.

Type

File

Arguments
Name Description
id - FileID!
Example
query {
  file(id: "eyJsbGIiOnsiZGVmIjpbIklqWVNOQWovLy8vLy8vLy8vLzhCRVAvLy8vLy8vLy8vL3dFcUhBb0VMMlp2YnhDa0F4b0dTR1ZzYkc4aEtQLy8vLy8vLy8vLy93RlNBRm9BIiwiQ2trS1IzTm9ZVEkxTmpwak1EQTVPV1U1TURrNFpEVmlObUkyWVdWaFpXWXpObVpsTnpsaU9UUTVOVEF4TnpoalptRmpPRGxsWVdKbE5XRmtZbUprTkdZeFptWXdNV0l3TkdWbSJdLCJtZXRhZGF0YSI6eyJzaGEyNTY6NWNjOGQ1M2VkZTRjYzUyODQ0OTIyYWFhZDlhYjIzMzc3MzY3NWMwMDJjOTM5NGZhYTk0OTg1OTZmNGFjMWRiNiI6eyJjYXBzIjp7ImNvbnN0cmFpbnRzIjp0cnVlLCJwbGF0Zm9ybSI6dHJ1ZX19LCJzaGEyNTY6YzAwOTllOTA5OGQ1YjZiNmFlYWVmMzZmZTc5Yjk0OTUwMTc4Y2ZhYzg5ZWFiZTVhZGJiZDRmMWZmMDFiMDRlZiI6eyJjYXBzIjp7ImZpbGUuYmFzZSI6dHJ1ZX19fSwiU291cmNlIjp7ImxvY2F0aW9ucyI6eyJzaGEyNTY6YzAwOTllOTA5OGQ1YjZiNmFlYWVmMzZmZTc5Yjk0OTUwMTc4Y2ZhYzg5ZWFiZTVhZGJiZDRmMWZmMDFiMDRlZiI6e319fX0sImZpbGUiOiJmb28iLCJwbGF0Zm9ybSI6eyJhcmNoaXRlY3R1cmUiOiIiLCJvcyI6IiJ9fQ==") {
      contents
    export(path: "greeting")
  }
}

Try it in the API Playground!

git

Description

Queries a git repository.

Arguments
Name Description
url - String! Url of the git repository. Can be formatted as https://{host}/{owner}/{repo}, git@{host}/{owner}/{repo} Suffix ".git" is optional.
keepGitDir - Boolean Set to true to keep .git directory.
experimentalServiceHost - ContainerID A service which must be started before the repo is fetched.
Example
query {
  git(url: "https://github.com/dagger/dagger", keepGitDir: true) {
    branch(name: "main") {
      tree {
        file(path: ".git/refs/heads/main") {
          contents
        }
      }
    }
  }
}

Try it in the API Playground!

host

Description

Queries the host environment.

Type

Host!

Example
query {
  host {
    read: directory(path: ".") {
      file(path: ".markdownlint.yaml") {
        contents
      }
    }
    home: envVariable(name: "HOME") {
      value
    }
    pwd: envVariable(name: "PWD") {
      value
    }
    write: directory(path: ".") {
      withNewFile(path: "greeting", contents: "Hello Dagger!") {
        export(path: ".")
      }
    }
  }
}

Try it in the API Playground!

http

Description

Returns a file containing an http remote url content.

Type

File!

Arguments
Name Description
url - String! HTTP url to get the content from (e.g., "https://docs.dagger.io").
experimentalServiceHost - ContainerID A service which must be started before the URL is fetched.
Example
query {
  http(url: "http://dagger.io") {
    size
    contents
  }
}

Try it in the API Playground!

pipeline

Description

Creates a named sub-pipeline.

Type

Query!

Arguments
Name Description
name - String! Pipeline name.
description - String Pipeline description.
labels - [PipelineLabel!] Pipeline labels.
Example
query {
  pipeline(name: "build", description: "Builds the app container") {
    container {
      id
    }
  }
}

Try it in the API Playground!

project

Description

Load a project from ID.

Type

Project!

Arguments
Name Description
id - ProjectID
Example

projectCommand

Description

Load a project command from ID.

Arguments
Name Description
id - ProjectCommandID
Example

secret

Description

Loads a secret from its ID.

Type

Secret!

Arguments
Name Description
id - SecretID!
Example
query {
  secret(id: "eyJob3N0X2VudiI6IkhPTUUifQ==") {
    plaintext
  }
}

Try it in the API Playground!

setSecret

Description

Sets a secret given a user defined name to its plaintext and returns the secret.

Type

Secret!

Arguments
Name Description
name - String! The user defined name for this secret
plaintext - String! The plaintext of the secret
Example

socket

Description

Loads a socket by its ID.

Type

Socket!

Arguments
Name Description
id - SocketID
Example
query {
  socket(id: "eyJob3N0X3BhdGgiOiIvdmFyL3J1bi9kb2NrZXIuc29jayJ9") {
    id
  }
}

Try it in the API Playground!

Types

Boolean

Description

The Boolean scalar type represents true or false.

BuildArg

Description

Key value object that represents a build argument.

Fields
Input Field Description
name - String! The build argument name.
value - String! The build argument value.
Example
{
  "name": "xyz789",
  "value": "xyz789"
}

CacheID

Description

A global cache volume identifier.

CacheSharingMode

Description

Sharing mode of the cache volume.

Values
Enum Value Description

SHARED

Shares the cache volume amongst many build pipelines

PRIVATE

Keeps a cache volume for a single build pipeline

LOCKED

Shares the cache volume amongst many build pipelines, but will serialize the writes
Example
"SHARED"

CacheVolume

Description

A directory whose contents persist across runs.

Fields
Field Name Description
id - CacheID!

Container

Description

An OCI-compatible container, also known as a docker container.

Fields
Field Name Description
id - ContainerID! A unique identifier for this container.
sync - ContainerID!

Forces evaluation of the pipeline in the engine.

It doesn't run the default command if no exec has been set.

platform - Platform! The platform this container executes and publishes as.
pipeline - Container! Creates a named sub-pipeline
Arguments
name - String!

Pipeline name.

description - String

Pipeline description.

labels - [PipelineLabel!]

Pipeline labels.

from - Container! Initializes this container from a pulled base image.
Arguments
address - String!

Image's address from its registry.

Formatted as [host]/[user]/[repo]:[tag] (e.g., "docker.io/dagger/dagger:main").

build - Container! Initializes this container from a Dockerfile build.
Arguments
context - DirectoryID!

Directory context used by the Dockerfile.

dockerfile - String

Path to the Dockerfile to use.

Default: './Dockerfile'.

buildArgs - [BuildArg!]

Additional build arguments.

target - String

Target build stage to build.

secrets - [SecretID!]

Secrets to pass to the build.

They will be mounted at /run/secrets/[secret-name].

rootfs - Directory! Retrieves this container's root filesystem. Mounts are not included.
fs - Directory! Retrieves this container's root filesystem. Mounts are not included. Replaced by rootfs.
withRootfs - Container! Initializes this container from this DirectoryID.
Arguments
withFS - Container! Initializes this container from this DirectoryID. Replaced by withRootfs.
Arguments
directory - Directory!

Retrieves a directory at the given path.

Mounts are included.

Arguments
path - String!

The path of the directory to retrieve (e.g., "./src").

file - File!

Retrieves a file at the given path.

Mounts are included.

Arguments
path - String!

The path of the file to retrieve (e.g., "./README.md").

user - String Retrieves the user to be set for all commands.
withUser - Container! Retrieves this container with a different command user.
Arguments
name - String!

The user to set (e.g., "root").

workdir - String Retrieves the working directory for all commands.
withWorkdir - Container! Retrieves this container with a different working directory.
Arguments
path - String!

The path to set as the working directory (e.g., "/app").

envVariables - [EnvVariable!]! Retrieves the list of environment variables passed to commands.
envVariable - String Retrieves the value of the specified environment variable.
Arguments
name - String!

The name of the environment variable to retrieve (e.g., "PATH").

withEnvVariable - Container! Retrieves this container plus the given environment variable.
Arguments
name - String!

The name of the environment variable (e.g., "HOST").

value - String!

The value of the environment variable. (e.g., "localhost").

expand - Boolean

Replace ${VAR} or $VAR in the value according to the current environment variables defined in the container (e.g., "/opt/bin:$PATH").

labels - [Label!]! Retrieves the list of labels passed to container.
label - String Retrieves the value of the specified label.
Arguments
name - String!
withLabel - Container! Retrieves this container plus the given label.
Arguments
name - String!

The name of the label (e.g., "org.opencontainers.artifact.created").

value - String!

The value of the label (e.g., "2023-01-01T00:00:00Z").

withoutLabel - Container! Retrieves this container minus the given environment label.
Arguments
name - String!

The name of the label to remove (e.g., "org.opencontainers.artifact.created").

withSecretVariable - Container! Retrieves this container plus an env variable containing the given secret.
Arguments
name - String!

The name of the secret variable (e.g., "API_SECRET").

secret - SecretID!

The identifier of the secret value.

withoutEnvVariable - Container! Retrieves this container minus the given environment variable.
Arguments
name - String!

The name of the environment variable (e.g., "HOST").

entrypoint - [String!] Retrieves entrypoint to be prepended to the arguments of all commands.
withEntrypoint - Container! Retrieves this container but with a different command entrypoint.
Arguments
args - [String!]!

Entrypoint to use for future executions (e.g., ["go", "run"]).

defaultArgs - [String!] Retrieves default arguments for future commands.
withDefaultArgs - Container! Configures default arguments for future commands.
Arguments
args - [String!]

Arguments to prepend to future executions (e.g., ["-v", "--no-cache"]).

mounts - [String!]! Retrieves the list of paths where a directory is mounted.
withMountedDirectory - Container! Retrieves this container plus a directory mounted at the given path.
Arguments
path - String!

Location of the mounted directory (e.g., "/mnt/directory").

source - DirectoryID!

Identifier of the mounted directory.

owner - String

A user:group to set for the mounted directory and its contents.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withMountedFile - Container! Retrieves this container plus a file mounted at the given path.
Arguments
path - String!

Location of the mounted file (e.g., "/tmp/file.txt").

source - FileID!

Identifier of the mounted file.

owner - String

A user or user:group to set for the mounted file.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withMountedTemp - Container! Retrieves this container plus a temporary directory mounted at the given path.
Arguments
path - String!

Location of the temporary directory (e.g., "/tmp/temp_dir").

withMountedCache - Container! Retrieves this container plus a cache volume mounted at the given path.
Arguments
path - String!

Location of the cache directory (e.g., "/cache/node_modules").

cache - CacheID!

Identifier of the cache volume to mount.

source - DirectoryID

Identifier of the directory to use as the cache volume's root.

sharing - CacheSharingMode

Sharing mode of the cache volume.

owner - String

A user:group to set for the mounted cache directory.

Note that this changes the ownership of the specified mount along with the initial filesystem provided by source (if any). It does not have any effect if/when the cache has already been created.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withMountedSecret - Container! Retrieves this container plus a secret mounted into a file at the given path.
Arguments
path - String!

Location of the secret file (e.g., "/tmp/secret.txt").

source - SecretID!

Identifier of the secret to mount.

owner - String

A user:group to set for the mounted secret.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withoutMount - Container! Retrieves this container after unmounting everything at the given path.
Arguments
path - String!

Location of the cache directory (e.g., "/cache/node_modules").

withFile - Container! Retrieves this container plus the contents of the given file copied to the given path.
Arguments
path - String!

Location of the copied file (e.g., "/tmp/file.txt").

source - FileID!

Identifier of the file to copy.

permissions - Int

Permission given to the copied file (e.g., 0600).

Default: 0644.

owner - String

A user:group to set for the file.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withNewFile - Container! Retrieves this container plus a new file written at the given path.
Arguments
path - String!

Location of the written file (e.g., "/tmp/file.txt").

contents - String

Content of the file to write (e.g., "Hello world!").

permissions - Int

Permission given to the written file (e.g., 0600).

Default: 0644.

owner - String

A user:group to set for the file.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withDirectory - Container! Retrieves this container plus a directory written at the given path.
Arguments
path - String!

Location of the written directory (e.g., "/tmp/directory").

directory - DirectoryID!

Identifier of the directory to write

exclude - [String!]

Patterns to exclude in the written directory (e.g., ["node_modules/**", ".gitignore", ".git/"]).

include - [String!]

Patterns to include in the written directory (e.g., ["*.go", "go.mod", "go.sum"]).

owner - String

A user:group to set for the directory and its contents.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withUnixSocket - Container! Retrieves this container plus a socket forwarded to the given Unix socket path.
Arguments
path - String!

Location of the forwarded Unix socket (e.g., "/tmp/socket").

source - SocketID!

Identifier of the socket to forward.

owner - String

A user:group to set for the mounted socket.

The user and group can either be an ID (1000:1000) or a name (foo:bar).

If the group is omitted, it defaults to the same as the user.

withoutUnixSocket - Container! Retrieves this container with a previously added Unix socket removed.
Arguments
path - String!

Location of the socket to remove (e.g., "/tmp/socket").

withExec - Container! Retrieves this container after executing the specified command inside it.
Arguments
args - [String!]!

Command to run instead of the container's default command (e.g., ["run", "main.go"]).

If empty, the container's default command is used.

skipEntrypoint - Boolean

If the container has an entrypoint, ignore it for args rather than using it to wrap them.

stdin - String

Content to write to the command's standard input before closing (e.g., "Hello world").

redirectStdout - String

Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").

redirectStderr - String

Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").

experimentalPrivilegedNesting - Boolean

Provides dagger access to the executed command.

Do not use this option unless you trust the command being executed. The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.

insecureRootCapabilities - Boolean

Execute the command with all root capabilities. This is similar to running a command with "sudo" or executing docker run with the --privileged flag. Containerization does not provide any security guarantees when using this option. It should only be used when absolutely necessary and only with trusted commands.

exec - Container! Retrieves this container after executing the specified command inside it. Replaced by withExec.
Arguments
args - [String!]

Command to run instead of the container's default command (e.g., ["run", "main.go"]).

stdin - String

Content to write to the command's standard input before closing (e.g., "Hello world").

redirectStdout - String

Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").

redirectStderr - String

Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").

experimentalPrivilegedNesting - Boolean

Provide dagger access to the executed command. Do not use this option unless you trust the command being executed. The command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.

exitCode - Int!

Exit code of the last executed command. Zero means success.

Will execute default command if none is set, or error if there's no default.

stdout - String!

The output stream of the last executed command.

Will execute default command if none is set, or error if there's no default.

stderr - String!

The error stream of the last executed command.

Will execute default command if none is set, or error if there's no default.

publish - String!

Publishes this container as a new image to the specified address.

Publish returns a fully qualified ref. It can also publish platform variants.

Arguments
address - String!

Registry's address to publish the image to.

Formatted as [host]/[user]/[repo]:[tag] (e.g. "docker.io/dagger/dagger:main").

platformVariants - [ContainerID!]

Identifiers for other platform specific containers. Used for multi-platform image.

forcedCompression - ImageLayerCompression

Force each layer of the published image to use the specified compression algorithm. If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip.

export - Boolean!

Writes the container as an OCI tarball to the destination file path on the host for the specified platform variants.

Return true on success. It can also publishes platform variants.

Arguments
path - String!

Host's destination path (e.g., "./tarball"). Path can be relative to the engine's workdir or absolute.

platformVariants - [ContainerID!]

Identifiers for other platform specific containers. Used for multi-platform image.

forcedCompression - ImageLayerCompression

Force each layer of the exported image to use the specified compression algorithm. If this is unset, then if a layer already has a compressed blob in the engine's cache, that will be used (this can result in a mix of compression algorithms for different layers). If this is unset and a layer has no compressed blob in the engine's cache, then it will be compressed using Gzip.

import - Container!

Reads the container from an OCI tarball.

NOTE: this involves unpacking the tarball to an OCI store on the host at $XDG_CACHE_DIR/dagger/oci. This directory can be removed whenever you like.

Arguments
source - FileID!

File to read the container from.

tag - String

Identifies the tag to import from the archive, if the archive bundles multiple tags.

withRegistryAuth - Container! Retrieves this container with a registry authentication for a given address.
Arguments
address - String!

Registry's address to bind the authentication to. Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).

username - String!

The username of the registry's account (e.g., "Dagger").

secret - SecretID!

The API key, password or token to authenticate to this registry.

withoutRegistryAuth - Container! Retrieves this container without the registry authentication of a given address.
Arguments
address - String!

Registry's address to remove the authentication from. Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).

imageRef - String The unique image reference which can only be retrieved immediately after the 'Container.From' call.
withExposedPort - Container!

Expose a network port.

Exposed ports serve two purposes:

  • For health checks and introspection, when running services
  • For setting the EXPOSE OCI field when publishing the container

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

Arguments
port - Int!

Port number to expose

protocol - NetworkProtocol

Transport layer network protocol

description - String

Optional port description

withoutExposedPort - Container!

Unexpose a previously exposed port.

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

Arguments
port - Int!

Port number to unexpose

protocol - NetworkProtocol

Port protocol to unexpose

exposedPorts - [Port!]!

Retrieves the list of exposed ports.

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

withServiceBinding - Container!

Establish a runtime dependency on a service.

The service will be started automatically when needed and detached when it is no longer needed, executing the default command if none is set.

The service will be reachable from the container via the provided hostname alias.

The service dependency will also convey to any files or directories produced by the container.

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

Arguments
alias - String!

A name that can be used to reach the service from the container

service - ContainerID!

Identifier of the service container

hostname - String!

Retrieves a hostname which can be used by clients to reach this container.

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

endpoint - String!

Retrieves an endpoint that clients can use to reach this container.

If no port is specified, the first exposed port is used. If none exist an error is returned.

If a scheme is specified, a URL is returned. Otherwise, a host:port pair is returned.

Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.

Arguments
port - Int

The exposed port number for the endpoint

scheme - String

Return a URL with the given scheme, eg. http for http://

ContainerID

Description

A unique container identifier. Null designates an empty container (scratch).

Directory

Description

A directory.

Fields
Field Name Description
id - DirectoryID! The content-addressed identifier of the directory.
pipeline - Directory! Creates a named sub-pipeline
Arguments
name - String!

Pipeline name.

description - String

Pipeline description.

labels - [PipelineLabel!]

Pipeline labels.

entries - [String!]! Returns a list of files and directories at the given path.
Arguments
path - String

Location of the directory to look at (e.g., "/src").

file - File! Retrieves a file at the given path.
Arguments
path - String!

Location of the file to retrieve (e.g., "README.md").

withFile - Directory! Retrieves this directory plus the contents of the given file copied to the given path.
Arguments
path - String!

Location of the copied file (e.g., "/file.txt").

source - FileID!

Identifier of the file to copy.

permissions - Int

Permission given to the copied file (e.g., 0600).

Default: 0644.

withNewFile - Directory! Retrieves this directory plus a new file written at the given path.
Arguments
path - String!

Location of the written file (e.g., "/file.txt").

contents - String!

Content of the written file (e.g., "Hello world!").

permissions - Int

Permission given to the copied file (e.g., 0600).

Default: 0644.

withoutFile - Directory! Retrieves this directory with the file at the given path removed.
Arguments
path - String!

Location of the file to remove (e.g., "/file.txt").

directory - Directory! Retrieves a directory at the given path.
Arguments
path - String!

Location of the directory to retrieve (e.g., "/src").

withDirectory - Directory! Retrieves this directory plus a directory written at the given path.
Arguments
path - String!

Location of the written directory (e.g., "/src/").

directory - DirectoryID!

Identifier of the directory to copy.

exclude - [String!]

Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).

include - [String!]

Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).

withNewDirectory - Directory! Retrieves this directory plus a new directory created at the given path.
Arguments
path - String!

Location of the directory created (e.g., "/logs").

permissions - Int

Permission granted to the created directory (e.g., 0777).

Default: 0755.

withoutDirectory - Directory! Retrieves this directory with the directory at the given path removed.
Arguments
path - String!

Location of the directory to remove (e.g., ".github/").

diff - Directory! Gets the difference between this directory and an another directory.
Arguments
other - DirectoryID!

Identifier of the directory to compare.

export - Boolean! Writes the contents of the directory to a path on the host.
Arguments
path - String!

Location of the copied directory (e.g., "logs/").

dockerBuild - Container! Builds a new Docker container from this directory.
Arguments
dockerfile - String

Path to the Dockerfile to use (e.g., "frontend.Dockerfile").

Defaults: './Dockerfile'.

platform - Platform

The platform to build.

buildArgs - [BuildArg!]

Build arguments to use in the build.

target - String

Target build stage to build.

secrets - [SecretID!]

Secrets to pass to the build.

They will be mounted at /run/secrets/[secret-name].

withTimestamps - Directory! Retrieves this directory with all file/dir timestamps set to the given time.
Arguments
timestamp - Int!

Timestamp to set dir/files in.

Formatted in seconds following Unix epoch (e.g., 1672531199).

DirectoryID

Description

A content-addressed directory identifier.

EnvVariable

Description

A simple key value object that represents an environment variable.

Fields
Field Name Description
name - String! The environment variable name.
value - String! The environment variable value.

File

Description

A file.

Fields
Field Name Description
id - FileID! Retrieves the content-addressed identifier of the file.
contents - String! Retrieves the contents of the file.
secret - Secret! Retrieves a secret referencing the contents of this file. insecure, leaves secret in cache. Superseded by setSecret
size - Int! Gets the size of the file, in bytes.
export - Boolean! Writes the file to a file path on the host.
Arguments
path - String!

Location of the written directory (e.g., "output.txt").

withTimestamps - File! Retrieves this file with its created/modified timestamps set to the given time.
Arguments
timestamp - Int!

Timestamp to set dir/files in.

Formatted in seconds following Unix epoch (e.g., 1672531199).

FileID

Description

A file identifier.

GitRef

Description

A git ref (tag, branch or commit).

Fields
Field Name Description
digest - String! The digest of the current value of this ref.
tree - Directory! The filesystem tree at this ref.
Arguments
sshKnownHosts - String
sshAuthSocket - SocketID

GitRepository

Description

A git repository.

Fields
Field Name Description
branches - [String!]! Lists of branches on the repository.
branch - GitRef! Returns details on one branch.
Arguments
name - String!

Branch's name (e.g., "main").

tags - [String!]! Lists of tags on the repository.
tag - GitRef! Returns details on one tag.
Arguments
name - String!

Tag's name (e.g., "v0.3.9").

commit - GitRef! Returns details on one commit.
Arguments
id - String!

Identifier of the commit (e.g., "b6315d8f2810962c601af73f86831f6866ea798b").

Host

Description

Information about the host execution environment.

Fields
Field Name Description
workdir - Directory! Retrieves the current working directory on the host. Use directory with path set to '.' instead.
Arguments
exclude - [String!]

Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).

include - [String!]

Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).

directory - Directory! Accesses a directory on the host.
Arguments
path - String!

Location of the directory to access (e.g., ".").

exclude - [String!]

Exclude artifacts that match the given pattern (e.g., ["node_modules/", ".git*"]).

include - [String!]

Include only artifacts that match the given pattern (e.g., ["app/", "package.*"]).

envVariable - HostVariable Accesses an environment variable on the host.
Arguments
name - String!

Name of the environment variable (e.g., "PATH").

unixSocket - Socket! Accesses a Unix socket on the host.
Arguments
path - String!

Location of the Unix socket (e.g., "/var/run/docker.sock").

HostVariable

Description

An environment variable on the host environment.

Fields
Field Name Description
value - String! The value of this variable.
secret - Secret! A secret referencing the value of this variable. been superseded by setSecret

ImageLayerCompression

Description

Compression algorithm to use for image layers

Values
Enum Value Description

Gzip

Zstd

EStarGZ

Uncompressed

Example
"Gzip"

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Label

Description

A simple key value object that represents a label.

Fields
Field Name Description
name - String! The label name.
value - String! The label value.

NetworkProtocol

Description

Transport layer network protocol associated to a port.

Values
Enum Value Description

TCP

TCP (Transmission Control Protocol)

UDP

UDP (User Datagram Protocol)
Example
"TCP"

PipelineLabel

Description

Key value object that represents a Pipeline label.

Fields
Input Field Description
name - String! Label name.
value - String! Label value.
Example
{
  "name": "abc123",
  "value": "abc123"
}

Platform

Description

The platform config OS and architecture in a Container.

The format is [os]/[platform]/[version] (e.g., "darwin/arm64/v7", "windows/amd64", "linux/arm64").

Port

Description

A port exposed by a container.

Fields
Field Name Description
port - Int! The port number.
protocol - NetworkProtocol! The transport layer network protocol.
description - String The port description.

Project

Description

A collection of Dagger resources that can be queried and invoked.

Fields
Field Name Description
id - String! A unique identifier for this project.
load - Project! Initialize this project from the given directory and config path
Arguments
source - DirectoryID!
configPath - String!
name - String! Name of the project
commands - [ProjectCommand!] Commands provided by this project

ProjectCommand

Description

A command defined in a project that can be invoked from the CLI.

Fields
Field Name Description
id - String! A unique identifier for this command.
name - String! The name of the command.
flags - [ProjectCommandFlag!] Flags accepted by this command.
description - String Documentation for what this command does.
subcommands - [ProjectCommand!] Subcommands, if any, that this command provides.

ProjectCommandFlag

Description

A flag accepted by a project command.

Fields
Field Name Description
name - String! The name of the flag.
description - String Documentation for what this flag sets.

ProjectCommandID

Description

A unique project command identifier.

ProjectID

Description

A unique project identifier.

Secret

Description

A reference to a secret value, which can be handled more safely than the value itself.

Fields
Field Name Description
id - SecretID! The identifier for this secret.
plaintext - String! The value of this secret.

SecretID

Description

A unique identifier for a secret.

Socket

Fields
Field Name Description
id - SocketID! The content-addressed identifier of the socket.

SocketID

Description

A content-addressed socket identifier.

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.