Skip to main content

Dagger NodeJS SDK

Enumerations

Classes

Type Aliases

BuildArg

BuildArg: Object

Type declaration

NameTypeDescription
namestringThe build argument name.
valuestringThe build argument value.

CacheVolumeID

CacheVolumeID: string & { __CacheVolumeID: never }

The CacheVolumeID scalar type represents an identifier for an object of type CacheVolume.


ClientContainerOpts

ClientContainerOpts: Object

Type declaration

NameTypeDescription
id?ContainerIDDEPRECATED: Use loadContainerFromID instead.
platform?PlatformPlatform to initialize the container with.

ClientDirectoryOpts

ClientDirectoryOpts: Object

Type declaration

NameTypeDescription
id?DirectoryIDDEPRECATED: Use loadDirectoryFromID isntead.

ClientGitOpts

ClientGitOpts: Object

Type declaration

NameTypeDescription
experimentalServiceHost?ServiceA service which must be started before the repo is fetched.
keepGitDir?booleanSet to true to keep .git directory.
sshAuthSocket?SocketSet SSH auth socket
sshKnownHosts?stringSet SSH known hosts

ClientHttpOpts

ClientHttpOpts: Object

Type declaration

NameTypeDescription
experimentalServiceHost?ServiceA service which must be started before the URL is fetched.

ClientModuleDependencyOpts

ClientModuleDependencyOpts: Object

Type declaration

NameTypeDescription
name?stringIf set, the name to use for the dependency. Otherwise, once installed to a parent module, the name of the dependency module will be used by default.

ClientModuleSourceOpts

ClientModuleSourceOpts: Object

Type declaration

NameTypeDescription
stable?booleanIf true, enforce that the source is a stable version for source kinds that support versioning.

ClientPipelineOpts

ClientPipelineOpts: Object

Type declaration

NameTypeDescription
description?stringDescription of the sub-pipeline.
labels?PipelineLabel[]Labels to apply to the sub-pipeline.

ContainerAsTarballOpts

ContainerAsTarballOpts: Object

Type declaration

NameTypeDescription
forcedCompression?ImageLayerCompressionForce each layer of the 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.
mediaTypes?ImageMediaTypesUse the specified media types for the image's layers. Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
platformVariants?Container[]Identifiers for other platform specific containers. Used for multi-platform images.

ContainerBuildOpts

ContainerBuildOpts: Object

Type declaration

NameTypeDescription
buildArgs?BuildArg[]Additional build arguments.
dockerfile?stringPath to the Dockerfile to use.
secrets?Secret[]Secrets to pass to the build. They will be mounted at /run/secrets/[secret-name] in the build container They can be accessed in the Dockerfile using the "secret" mount type and mount path /run/secrets/[secret-name], e.g. RUN --mount=type=secret,id=my-secret curl http://example.com?token=$(cat /run/secrets/my-secret)
target?stringTarget build stage to build.

ContainerExportOpts

ContainerExportOpts: Object

Type declaration

NameTypeDescription
forcedCompression?ImageLayerCompressionForce 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.
mediaTypes?ImageMediaTypesUse the specified media types for the exported image's layers. Defaults to OCI, which is largely compatible with most recent container runtimes, but Docker may be needed for older runtimes without OCI support.
platformVariants?Container[]Identifiers for other platform specific containers. Used for multi-platform image.

ContainerID

ContainerID: string & { __ContainerID: never }

The ContainerID scalar type represents an identifier for an object of type Container.


ContainerImportOpts

ContainerImportOpts: Object

Type declaration

NameTypeDescription
tag?stringIdentifies the tag to import from the archive, if the archive bundles multiple tags.

ContainerPipelineOpts

ContainerPipelineOpts: Object

Type declaration

NameTypeDescription
description?stringDescription of the sub-pipeline.
labels?PipelineLabel[]Labels to apply to the sub-pipeline.

ContainerPublishOpts

ContainerPublishOpts: Object

Type declaration

NameTypeDescription
forcedCompression?ImageLayerCompressionForce 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.
mediaTypes?ImageMediaTypesUse the specified media types for the published image's layers. Defaults to OCI, which is largely compatible with most recent registries, but Docker may be needed for older registries without OCI support.
platformVariants?Container[]Identifiers for other platform specific containers. Used for multi-platform image.

ContainerTerminalOpts

ContainerTerminalOpts: Object

Type declaration

NameTypeDescription
cmd?string[]If set, override the container's default terminal command and invoke these command arguments instead.

ContainerWithDirectoryOpts

ContainerWithDirectoryOpts: Object

Type declaration

NameTypeDescription
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?stringA 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.

ContainerWithEntrypointOpts

ContainerWithEntrypointOpts: Object

Type declaration

NameTypeDescription
keepDefaultArgs?booleanDon't remove the default arguments when setting the entrypoint.

ContainerWithEnvVariableOpts

ContainerWithEnvVariableOpts: Object

Type declaration

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

ContainerWithExecOpts

ContainerWithExecOpts: Object

Type declaration

NameTypeDescription
experimentalPrivilegedNesting?booleanProvides 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?booleanExecute 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.
redirectStderr?stringRedirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
redirectStdout?stringRedirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
skipEntrypoint?booleanIf the container has an entrypoint, ignore it for args rather than using it to wrap them.
stdin?stringContent to write to the command's standard input before closing (e.g., "Hello world").

ContainerWithExposedPortOpts

ContainerWithExposedPortOpts: Object

Type declaration

NameTypeDescription
description?stringOptional port description
experimentalSkipHealthcheck?booleanSkip the health check when run as a service.
protocol?NetworkProtocolTransport layer network protocol

ContainerWithFileOpts

ContainerWithFileOpts: Object

Type declaration

NameTypeDescription
owner?stringA 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.
permissions?numberPermission given to the copied file (e.g., 0600).

ContainerWithFilesOpts

ContainerWithFilesOpts: Object

Type declaration

NameTypeDescription
owner?stringA user:group to set for the files. 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.
permissions?numberPermission given to the copied files (e.g., 0600).

ContainerWithMountedCacheOpts

ContainerWithMountedCacheOpts: Object

Type declaration

NameTypeDescription
owner?stringA 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.
sharing?CacheSharingModeSharing mode of the cache volume.
source?DirectoryIdentifier of the directory to use as the cache volume's root.

ContainerWithMountedDirectoryOpts

ContainerWithMountedDirectoryOpts: Object

Type declaration

NameTypeDescription
owner?stringA 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.

ContainerWithMountedFileOpts

ContainerWithMountedFileOpts: Object

Type declaration

NameTypeDescription
owner?stringA 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.

ContainerWithMountedSecretOpts

ContainerWithMountedSecretOpts: Object

Type declaration

NameTypeDescription
mode?numberPermission given to the mounted secret (e.g., 0600). This option requires an owner to be set to be active.
owner?stringA 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.

ContainerWithNewFileOpts

ContainerWithNewFileOpts: Object

Type declaration

NameTypeDescription
contents?stringContent of the file to write (e.g., "Hello world!").
owner?stringA 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.
permissions?numberPermission given to the written file (e.g., 0600).

ContainerWithUnixSocketOpts

ContainerWithUnixSocketOpts: Object

Type declaration

NameTypeDescription
owner?stringA 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.

ContainerWithoutEntrypointOpts

ContainerWithoutEntrypointOpts: Object

Type declaration

NameTypeDescription
keepDefaultArgs?booleanDon't remove the default arguments when unsetting the entrypoint.

ContainerWithoutExposedPortOpts

ContainerWithoutExposedPortOpts: Object

Type declaration

NameTypeDescription
protocol?NetworkProtocolPort protocol to unexpose

CurrentModuleID

CurrentModuleID: string & { __CurrentModuleID: never }

The CurrentModuleID scalar type represents an identifier for an object of type CurrentModule.


CurrentModuleWorkdirOpts

CurrentModuleWorkdirOpts: Object

Type declaration

NameTypeDescription
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.*"]).

DirectoryAsModuleOpts

DirectoryAsModuleOpts: Object

Type declaration

NameTypeDescription
sourceRootPath?stringAn optional subpath of the directory which contains the module's configuration file. This is needed when the module code is in a subdirectory but requires parent directories to be loaded in order to execute. For example, the module source code may need a go.mod, project.toml, package.json, etc. file from a parent directory. If not set, the module source code is loaded from the root of the directory.

DirectoryDockerBuildOpts

DirectoryDockerBuildOpts: Object

Type declaration

NameTypeDescription
buildArgs?BuildArg[]Build arguments to use in the build.
dockerfile?stringPath to the Dockerfile to use (e.g., "frontend.Dockerfile").
platform?PlatformThe platform to build.
secrets?Secret[]Secrets to pass to the build. They will be mounted at /run/secrets/[secret-name].
target?stringTarget build stage to build.

DirectoryEntriesOpts

DirectoryEntriesOpts: Object

Type declaration

NameTypeDescription
path?stringLocation of the directory to look at (e.g., "/src").

DirectoryID

DirectoryID: string & { __DirectoryID: never }

The DirectoryID scalar type represents an identifier for an object of type Directory.


DirectoryPipelineOpts

DirectoryPipelineOpts: Object

Type declaration

NameTypeDescription
description?stringDescription of the sub-pipeline.
labels?PipelineLabel[]Labels to apply to the sub-pipeline.

DirectoryWithDirectoryOpts

DirectoryWithDirectoryOpts: Object

Type declaration

NameTypeDescription
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.*"]).

DirectoryWithFileOpts

DirectoryWithFileOpts: Object

Type declaration

NameTypeDescription
permissions?numberPermission given to the copied file (e.g., 0600).

DirectoryWithFilesOpts

DirectoryWithFilesOpts: Object

Type declaration

NameTypeDescription
permissions?numberPermission given to the copied files (e.g., 0600).

DirectoryWithNewDirectoryOpts

DirectoryWithNewDirectoryOpts: Object

Type declaration

NameTypeDescription
permissions?numberPermission granted to the created directory (e.g., 0777).

DirectoryWithNewFileOpts

DirectoryWithNewFileOpts: Object

Type declaration

NameTypeDescription
permissions?numberPermission given to the copied file (e.g., 0600).

EnvVariableID

EnvVariableID: string & { __EnvVariableID: never }

The EnvVariableID scalar type represents an identifier for an object of type EnvVariable.


FieldTypeDefID

FieldTypeDefID: string & { __FieldTypeDefID: never }

The FieldTypeDefID scalar type represents an identifier for an object of type FieldTypeDef.


FileExportOpts

FileExportOpts: Object

Type declaration

NameTypeDescription
allowParentDirPath?booleanIf allowParentDirPath is true, the path argument can be a directory path, in which case the file will be created in that directory.

FileID

FileID: string & { __FileID: never }

The FileID scalar type represents an identifier for an object of type File.


FunctionArgID

FunctionArgID: string & { __FunctionArgID: never }

The FunctionArgID scalar type represents an identifier for an object of type FunctionArg.


FunctionCallArgValueID

FunctionCallArgValueID: string & { __FunctionCallArgValueID: never }

The FunctionCallArgValueID scalar type represents an identifier for an object of type FunctionCallArgValue.


FunctionCallID

FunctionCallID: string & { __FunctionCallID: never }

The FunctionCallID scalar type represents an identifier for an object of type FunctionCall.


FunctionID

FunctionID: string & { __FunctionID: never }

The FunctionID scalar type represents an identifier for an object of type Function.


FunctionWithArgOpts

FunctionWithArgOpts: Object

Type declaration

NameTypeDescription
defaultValue?JSONA default value to use for this argument if not explicitly set by the caller, if any
description?stringA doc string for the argument, if any

GeneratedCodeID

GeneratedCodeID: string & { __GeneratedCodeID: never }

The GeneratedCodeID scalar type represents an identifier for an object of type GeneratedCode.


GitModuleSourceID

GitModuleSourceID: string & { __GitModuleSourceID: never }

The GitModuleSourceID scalar type represents an identifier for an object of type GitModuleSource.


GitRefID

GitRefID: string & { __GitRefID: never }

The GitRefID scalar type represents an identifier for an object of type GitRef.


GitRefTreeOpts

GitRefTreeOpts: Object

Type declaration

NameTypeDescription
sshAuthSocket?SocketDEPRECATED: This option should be passed to git instead.
sshKnownHosts?stringDEPRECATED: This option should be passed to git instead.

GitRepositoryID

GitRepositoryID: string & { __GitRepositoryID: never }

The GitRepositoryID scalar type represents an identifier for an object of type GitRepository.


HostDirectoryOpts

HostDirectoryOpts: Object

Type declaration

NameTypeDescription
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.*"]).

HostID

HostID: string & { __HostID: never }

The HostID scalar type represents an identifier for an object of type Host.


HostServiceOpts

HostServiceOpts: Object

Type declaration

NameTypeDescription
host?stringUpstream host to forward traffic to.
portsPortForward[]Ports to expose via the service, forwarding through the host network. If a port's frontend is unspecified or 0, it defaults to the same as the backend port. An empty set of ports is not valid; an error will be returned.

HostTunnelOpts

HostTunnelOpts: Object

Type declaration

NameTypeDescription
native?booleanMap each service port to the same port on the host, as if the service were running natively. Note: enabling may result in port conflicts.
ports?PortForward[]Configure explicit port forwarding rules for the tunnel. If a port's frontend is unspecified or 0, a random port will be chosen by the host. If no ports are given, all of the service's ports are forwarded. If native is true, each port maps to the same port on the host. If native is false, each port maps to a random port chosen by the host. If ports are given and native is true, the ports are additive.

InputTypeDefID

InputTypeDefID: string & { __InputTypeDefID: never }

The InputTypeDefID scalar type represents an identifier for an object of type InputTypeDef.


InterfaceTypeDefID

InterfaceTypeDefID: string & { __InterfaceTypeDefID: never }

The InterfaceTypeDefID scalar type represents an identifier for an object of type InterfaceTypeDef.


JSON

JSON: string & { __JSON: never }

An arbitrary JSON-encoded value.


LabelID

LabelID: string & { __LabelID: never }

The LabelID scalar type represents an identifier for an object of type Label.


ListTypeDefID

ListTypeDefID: string & { __ListTypeDefID: never }

The ListTypeDefID scalar type represents an identifier for an object of type ListTypeDef.


LocalModuleSourceID

LocalModuleSourceID: string & { __LocalModuleSourceID: never }

The LocalModuleSourceID scalar type represents an identifier for an object of type LocalModuleSource.


ModuleDependencyID

ModuleDependencyID: string & { __ModuleDependencyID: never }

The ModuleDependencyID scalar type represents an identifier for an object of type ModuleDependency.


ModuleID

ModuleID: string & { __ModuleID: never }

The ModuleID scalar type represents an identifier for an object of type Module.


ModuleSourceID

ModuleSourceID: string & { __ModuleSourceID: never }

The ModuleSourceID scalar type represents an identifier for an object of type ModuleSource.


ObjectTypeDefID

ObjectTypeDefID: string & { __ObjectTypeDefID: never }

The ObjectTypeDefID scalar type represents an identifier for an object of type ObjectTypeDef.


PipelineLabel

PipelineLabel: Object

Type declaration

NameTypeDescription
namestringLabel name.
valuestringLabel value.

Platform

Platform: string & { __Platform: never }

The platform config OS and architecture in a Container.

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


PortForward

PortForward: Object

Type declaration

NameTypeDescription
backendnumberDestination port for traffic.
frontend?numberPort to expose to clients. If unspecified, a default will be chosen.
protocol?NetworkProtocolTransport layer protocol to use for traffic.

PortID

PortID: string & { __PortID: never }

The PortID scalar type represents an identifier for an object of type Port.


SecretID

SecretID: string & { __SecretID: never }

The SecretID scalar type represents an identifier for an object of type Secret.


ServiceEndpointOpts

ServiceEndpointOpts: Object

Type declaration

NameTypeDescription
port?numberThe exposed port number for the endpoint
scheme?stringReturn a URL with the given scheme, eg. http for http://

ServiceID

ServiceID: string & { __ServiceID: never }

The ServiceID scalar type represents an identifier for an object of type Service.


ServiceStopOpts

ServiceStopOpts: Object

Type declaration

NameTypeDescription
kill?booleanImmediately kill the service without waiting for a graceful exit

ServiceUpOpts

ServiceUpOpts: Object

Type declaration

NameTypeDescription
ports?PortForward[]List of frontend/backend port mappings to forward. Frontend is the port accepting traffic on the host, backend is the service port.
random?booleanBind each tunnel port to a random port on the host.

SocketID

SocketID: string & { __SocketID: never }

The SocketID scalar type represents an identifier for an object of type Socket.


TerminalID

TerminalID: string & { __TerminalID: never }

The TerminalID scalar type represents an identifier for an object of type Terminal.


TypeDefID

TypeDefID: string & { __TypeDefID: never }

The TypeDefID scalar type represents an identifier for an object of type TypeDef.


TypeDefWithFieldOpts

TypeDefWithFieldOpts: Object

Type declaration

NameTypeDescription
description?stringA doc string for the field, if any

TypeDefWithInterfaceOpts

TypeDefWithInterfaceOpts: Object

Type declaration

NameType
description?string

TypeDefWithObjectOpts

TypeDefWithObjectOpts: Object

Type declaration

NameType
description?string

Void

Void: string & { __Void: never }

The absence of a value.

A Null Void is used as a placeholder for resolvers that do not return anything.


__TypeEnumValuesOpts

__TypeEnumValuesOpts: Object

Type declaration

NameType
includeDeprecated?boolean

__TypeFieldsOpts

__TypeFieldsOpts: Object

Type declaration

NameType
includeDeprecated?boolean

Variables

dag

Const dag: Client