Container

Struct Container 

Source
pub struct Container {
    pub proc: Option<Arc<DaggerSessionProc>>,
    pub selection: Selection,
    pub graphql_client: DynGraphQLClient,
}

Fields§

§proc: Option<Arc<DaggerSessionProc>>§selection: Selection§graphql_client: DynGraphQLClient

Implementations§

Source§

impl Container

Source

pub fn as_service(&self) -> Service

Turn the container into a Service. Be sure to set any exposed ports before this conversion.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_service_opts<'a>(&self, opts: ContainerAsServiceOpts<'a>) -> Service

Turn the container into a Service. Be sure to set any exposed ports before this conversion.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_tarball(&self) -> File

Package the container state as an OCI image, and return it as a tar archive

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn as_tarball_opts(&self, opts: ContainerAsTarballOpts) -> File

Package the container state as an OCI image, and return it as a tar archive

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn build(&self, context: impl IntoID<DirectoryId>) -> Container

Initializes this container from a Dockerfile build.

§Arguments
  • context - Directory context used by the Dockerfile.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn build_opts<'a>( &self, context: impl IntoID<DirectoryId>, opts: ContainerBuildOpts<'a>, ) -> Container

Initializes this container from a Dockerfile build.

§Arguments
  • context - Directory context used by the Dockerfile.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn combined_output(&self) -> Result<String, DaggerError>

The combined buffered standard output and standard error stream of the last executed command Returns an error if no command was executed

Source

pub async fn default_args(&self) -> Result<Vec<String>, DaggerError>

Return the container’s default arguments.

Source

pub fn directory(&self, path: impl Into<String>) -> Directory

Retrieve a directory from the container’s root filesystem Mounts are included.

§Arguments
  • path - The path of the directory to retrieve (e.g., “./src”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn directory_opts( &self, path: impl Into<String>, opts: ContainerDirectoryOpts, ) -> Directory

Retrieve a directory from the container’s root filesystem Mounts are included.

§Arguments
  • path - The path of the directory to retrieve (e.g., “./src”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn entrypoint(&self) -> Result<Vec<String>, DaggerError>

Return the container’s OCI entrypoint.

Source

pub async fn env_variable( &self, name: impl Into<String>, ) -> Result<String, DaggerError>

Retrieves the value of the specified environment variable.

§Arguments
  • name - The name of the environment variable to retrieve (e.g., “PATH”).
Source

pub fn env_variables(&self) -> Vec<EnvVariable>

Retrieves the list of environment variables passed to commands.

Source

pub async fn exists(&self, path: impl Into<String>) -> Result<bool, DaggerError>

check if a file or directory exists

§Arguments
  • path - Path to check (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn exists_opts( &self, path: impl Into<String>, opts: ContainerExistsOpts, ) -> Result<bool, DaggerError>

check if a file or directory exists

§Arguments
  • path - Path to check (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn exit_code(&self) -> Result<isize, DaggerError>

The exit code of the last executed command Returns an error if no command was executed

Source

pub fn experimental_with_all_gp_us(&self) -> Container

EXPERIMENTAL API! Subject to change/removal at any time. Configures all available GPUs on the host to be accessible to this container. This currently works for Nvidia devices only.

Source

pub fn experimental_with_gpu( &self, devices: Vec<impl Into<String>>, ) -> Container

EXPERIMENTAL API! Subject to change/removal at any time. Configures the provided list of devices to be accessible to this container. This currently works for Nvidia devices only.

§Arguments
  • devices - List of devices to be accessible to this container.
Source

pub async fn export( &self, path: impl Into<String>, ) -> Result<String, DaggerError>

Writes the container as an OCI tarball to the destination file path on the host. It can also export platform variants.

§Arguments
  • path - Host’s destination path (e.g., “./tarball”).

Path can be relative to the engine’s workdir or absolute.

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export_opts( &self, path: impl Into<String>, opts: ContainerExportOpts, ) -> Result<String, DaggerError>

Writes the container as an OCI tarball to the destination file path on the host. It can also export platform variants.

§Arguments
  • path - Host’s destination path (e.g., “./tarball”).

Path can be relative to the engine’s workdir or absolute.

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export_image( &self, name: impl Into<String>, ) -> Result<Void, DaggerError>

Exports the container as an image to the host’s container image store.

§Arguments
  • name - Name of image to export to in the host’s store
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn export_image_opts( &self, name: impl Into<String>, opts: ContainerExportImageOpts, ) -> Result<Void, DaggerError>

Exports the container as an image to the host’s container image store.

§Arguments
  • name - Name of image to export to in the host’s store
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn exposed_ports(&self) -> Vec<Port>

Retrieves the list of exposed ports. This includes ports already exposed by the image, even if not explicitly added with dagger.

Source

pub fn file(&self, path: impl Into<String>) -> File

Retrieves a file at the given path. Mounts are included.

§Arguments
  • path - The path of the file to retrieve (e.g., “./README.md”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn file_opts( &self, path: impl Into<String>, opts: ContainerFileOpts, ) -> File

Retrieves a file at the given path. Mounts are included.

§Arguments
  • path - The path of the file to retrieve (e.g., “./README.md”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn from(&self, address: impl Into<String>) -> Container

Download a container image, and apply it to the container state. All previous state will be lost.

§Arguments
  • address - Address of the container image to download, in standard OCI ref format. Example:“registry.dagger.io/engine:latest”
Source

pub async fn id(&self) -> Result<ContainerId, DaggerError>

A unique identifier for this Container.

Source

pub async fn image_ref(&self) -> Result<String, DaggerError>

The unique image reference which can only be retrieved immediately after the ‘Container.From’ call.

Source

pub fn import(&self, source: impl IntoID<FileId>) -> Container

Reads the container from an OCI tarball.

§Arguments
  • source - File to read the container from.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn import_opts<'a>( &self, source: impl IntoID<FileId>, opts: ContainerImportOpts<'a>, ) -> Container

Reads the container from an OCI tarball.

§Arguments
  • source - File to read the container from.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn label( &self, name: impl Into<String>, ) -> Result<String, DaggerError>

Retrieves the value of the specified label.

§Arguments
  • name - The name of the label (e.g., “org.opencontainers.artifact.created”).
Source

pub fn labels(&self) -> Vec<Label>

Retrieves the list of labels passed to container.

Source

pub async fn mounts(&self) -> Result<Vec<String>, DaggerError>

Retrieves the list of paths where a directory is mounted.

Source

pub async fn platform(&self) -> Result<Platform, DaggerError>

The platform this container executes and publishes as.

Source

pub async fn publish( &self, address: impl Into<String>, ) -> Result<String, DaggerError>

Package the container state as an OCI image, and publish it to a registry Returns the fully qualified address of the published image, with digest

§Arguments
  • address - The OCI address to publish to

Same format as “docker push”. Example: “registry.example.com/user/repo:tag”

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn publish_opts( &self, address: impl Into<String>, opts: ContainerPublishOpts, ) -> Result<String, DaggerError>

Package the container state as an OCI image, and publish it to a registry Returns the fully qualified address of the published image, with digest

§Arguments
  • address - The OCI address to publish to

Same format as “docker push”. Example: “registry.example.com/user/repo:tag”

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn rootfs(&self) -> Directory

Return a snapshot of the container’s root filesystem. The snapshot can be modified then written back using withRootfs. Use that method for filesystem modifications.

Source

pub async fn stderr(&self) -> Result<String, DaggerError>

The buffered standard error stream of the last executed command Returns an error if no command was executed

Source

pub async fn stdout(&self) -> Result<String, DaggerError>

The buffered standard output stream of the last executed command Returns an error if no command was executed

Source

pub async fn sync(&self) -> Result<ContainerId, DaggerError>

Forces evaluation of the pipeline in the engine. It doesn’t run the default command if no exec has been set.

Source

pub fn terminal(&self) -> Container

Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default).

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn terminal_opts<'a>(&self, opts: ContainerTerminalOpts<'a>) -> Container

Opens an interactive terminal for this container using its configured default terminal command if not overridden by args (or sh as a fallback default).

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn up(&self) -> Result<Void, DaggerError>

Starts a Service and creates a tunnel that forwards traffic from the caller’s network to that service. Be sure to set any exposed ports before calling this api.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn up_opts<'a>( &self, opts: ContainerUpOpts<'a>, ) -> Result<Void, DaggerError>

Starts a Service and creates a tunnel that forwards traffic from the caller’s network to that service. Be sure to set any exposed ports before calling this api.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub async fn user(&self) -> Result<String, DaggerError>

Retrieves the user to be set for all commands.

Source

pub fn with_annotation( &self, name: impl Into<String>, value: impl Into<String>, ) -> Container

Retrieves this container plus the given OCI anotation.

§Arguments
  • name - The name of the annotation.
  • value - The value of the annotation.
Source

pub fn with_default_args(&self, args: Vec<impl Into<String>>) -> Container

Configures default arguments for future commands. Like CMD in Dockerfile.

§Arguments
  • args - Arguments to prepend to future executions (e.g., [“-v”, “–no-cache”]).
Source

pub fn with_default_terminal_cmd( &self, args: Vec<impl Into<String>>, ) -> Container

Set the default command to invoke for the container’s terminal API.

§Arguments
  • args - The args of the command.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_default_terminal_cmd_opts( &self, args: Vec<impl Into<String>>, opts: ContainerWithDefaultTerminalCmdOpts, ) -> Container

Set the default command to invoke for the container’s terminal API.

§Arguments
  • args - The args of the command.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_directory( &self, path: impl Into<String>, directory: impl IntoID<DirectoryId>, ) -> Container

Return a new container snapshot, with a directory added to its filesystem

§Arguments
  • path - Location of the written directory (e.g., “/tmp/directory”).
  • directory - Identifier of the directory to write
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_directory_opts<'a>( &self, path: impl Into<String>, directory: impl IntoID<DirectoryId>, opts: ContainerWithDirectoryOpts<'a>, ) -> Container

Return a new container snapshot, with a directory added to its filesystem

§Arguments
  • path - Location of the written directory (e.g., “/tmp/directory”).
  • directory - Identifier of the directory to write
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_entrypoint(&self, args: Vec<impl Into<String>>) -> Container

Set an OCI-style entrypoint. It will be included in the container’s OCI configuration. Note, withExec ignores the entrypoint by default.

§Arguments
  • args - Arguments of the entrypoint. Example: [“go”, “run”].
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_entrypoint_opts( &self, args: Vec<impl Into<String>>, opts: ContainerWithEntrypointOpts, ) -> Container

Set an OCI-style entrypoint. It will be included in the container’s OCI configuration. Note, withExec ignores the entrypoint by default.

§Arguments
  • args - Arguments of the entrypoint. Example: [“go”, “run”].
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_env_variable( &self, name: impl Into<String>, value: impl Into<String>, ) -> Container

Set a new environment variable in the container.

§Arguments
  • name - Name of the environment variable (e.g., “HOST”).
  • value - Value of the environment variable. (e.g., “localhost”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_env_variable_opts( &self, name: impl Into<String>, value: impl Into<String>, opts: ContainerWithEnvVariableOpts, ) -> Container

Set a new environment variable in the container.

§Arguments
  • name - Name of the environment variable (e.g., “HOST”).
  • value - Value of the environment variable. (e.g., “localhost”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_exec(&self, args: Vec<impl Into<String>>) -> Container

Execute a command in the container, and return a new snapshot of the container state after execution.

§Arguments
  • args - Command to execute. Must be valid exec() arguments, not a shell command. Example: [“go”, “run”, “main.go”].

To run a shell command, execute the shell and pass the shell command as argument. Example: [“sh”, “-c”, “ls -l | grep foo”]

Defaults to the container’s default arguments (see “defaultArgs” and “withDefaultArgs”).

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_exec_opts<'a>( &self, args: Vec<impl Into<String>>, opts: ContainerWithExecOpts<'a>, ) -> Container

Execute a command in the container, and return a new snapshot of the container state after execution.

§Arguments
  • args - Command to execute. Must be valid exec() arguments, not a shell command. Example: [“go”, “run”, “main.go”].

To run a shell command, execute the shell and pass the shell command as argument. Example: [“sh”, “-c”, “ls -l | grep foo”]

Defaults to the container’s default arguments (see “defaultArgs” and “withDefaultArgs”).

  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_exposed_port(&self, port: isize) -> Container

Expose a network port. Like EXPOSE in Dockerfile (but with healthcheck support) Exposed ports serve two purposes:

  • For health checks and introspection, when running services
  • For setting the EXPOSE OCI field when publishing the container
§Arguments
  • port - Port number to expose. Example: 8080
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_exposed_port_opts<'a>( &self, port: isize, opts: ContainerWithExposedPortOpts<'a>, ) -> Container

Expose a network port. Like EXPOSE in Dockerfile (but with healthcheck support) Exposed ports serve two purposes:

  • For health checks and introspection, when running services
  • For setting the EXPOSE OCI field when publishing the container
§Arguments
  • port - Port number to expose. Example: 8080
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file( &self, path: impl Into<String>, source: impl IntoID<FileId>, ) -> Container

Return a container snapshot with a file added

§Arguments
  • path - Path of the new file. Example: “/path/to/new-file.txt”
  • source - File to add
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_file_opts<'a>( &self, path: impl Into<String>, source: impl IntoID<FileId>, opts: ContainerWithFileOpts<'a>, ) -> Container

Return a container snapshot with a file added

§Arguments
  • path - Path of the new file. Example: “/path/to/new-file.txt”
  • source - File to add
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_files( &self, path: impl Into<String>, sources: Vec<FileId>, ) -> Container

Retrieves this container plus the contents of the given files copied to the given path.

§Arguments
  • path - Location where copied files should be placed (e.g., “/src”).
  • sources - Identifiers of the files to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_files_opts<'a>( &self, path: impl Into<String>, sources: Vec<FileId>, opts: ContainerWithFilesOpts<'a>, ) -> Container

Retrieves this container plus the contents of the given files copied to the given path.

§Arguments
  • path - Location where copied files should be placed (e.g., “/src”).
  • sources - Identifiers of the files to copy.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_label( &self, name: impl Into<String>, value: impl Into<String>, ) -> Container

Retrieves this container plus the given label.

§Arguments
  • name - The name of the label (e.g., “org.opencontainers.artifact.created”).
  • value - The value of the label (e.g., “2023-01-01T00:00:00Z”).
Source

pub fn with_mounted_cache( &self, path: impl Into<String>, cache: impl IntoID<CacheVolumeId>, ) -> Container

Retrieves this container plus a cache volume mounted at the given path.

§Arguments
  • path - Location of the cache directory (e.g., “/root/.npm”).
  • cache - Identifier of the cache volume to mount.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_cache_opts<'a>( &self, path: impl Into<String>, cache: impl IntoID<CacheVolumeId>, opts: ContainerWithMountedCacheOpts<'a>, ) -> Container

Retrieves this container plus a cache volume mounted at the given path.

§Arguments
  • path - Location of the cache directory (e.g., “/root/.npm”).
  • cache - Identifier of the cache volume to mount.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_directory( &self, path: impl Into<String>, source: impl IntoID<DirectoryId>, ) -> Container

Retrieves this container plus a directory mounted at the given path.

§Arguments
  • path - Location of the mounted directory (e.g., “/mnt/directory”).
  • source - Identifier of the mounted directory.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_directory_opts<'a>( &self, path: impl Into<String>, source: impl IntoID<DirectoryId>, opts: ContainerWithMountedDirectoryOpts<'a>, ) -> Container

Retrieves this container plus a directory mounted at the given path.

§Arguments
  • path - Location of the mounted directory (e.g., “/mnt/directory”).
  • source - Identifier of the mounted directory.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_file( &self, path: impl Into<String>, source: impl IntoID<FileId>, ) -> Container

Retrieves this container plus a file mounted at the given path.

§Arguments
  • path - Location of the mounted file (e.g., “/tmp/file.txt”).
  • source - Identifier of the mounted file.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_file_opts<'a>( &self, path: impl Into<String>, source: impl IntoID<FileId>, opts: ContainerWithMountedFileOpts<'a>, ) -> Container

Retrieves this container plus a file mounted at the given path.

§Arguments
  • path - Location of the mounted file (e.g., “/tmp/file.txt”).
  • source - Identifier of the mounted file.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_secret( &self, path: impl Into<String>, source: impl IntoID<SecretId>, ) -> Container

Retrieves this container plus a secret mounted into a file at the given path.

§Arguments
  • path - Location of the secret file (e.g., “/tmp/secret.txt”).
  • source - Identifier of the secret to mount.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_secret_opts<'a>( &self, path: impl Into<String>, source: impl IntoID<SecretId>, opts: ContainerWithMountedSecretOpts<'a>, ) -> Container

Retrieves this container plus a secret mounted into a file at the given path.

§Arguments
  • path - Location of the secret file (e.g., “/tmp/secret.txt”).
  • source - Identifier of the secret to mount.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_temp(&self, path: impl Into<String>) -> Container

Retrieves this container plus a temporary directory mounted at the given path. Any writes will be ephemeral to a single withExec call; they will not be persisted to subsequent withExecs.

§Arguments
  • path - Location of the temporary directory (e.g., “/tmp/temp_dir”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_mounted_temp_opts( &self, path: impl Into<String>, opts: ContainerWithMountedTempOpts, ) -> Container

Retrieves this container plus a temporary directory mounted at the given path. Any writes will be ephemeral to a single withExec call; they will not be persisted to subsequent withExecs.

§Arguments
  • path - Location of the temporary directory (e.g., “/tmp/temp_dir”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_file( &self, path: impl Into<String>, contents: impl Into<String>, ) -> Container

Return a new container snapshot, with a file added to its filesystem with text content

§Arguments
  • path - Path of the new file. May be relative or absolute. Example: “README.md” or “/etc/profile”
  • contents - Contents of the new file. Example: “Hello world!”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_new_file_opts<'a>( &self, path: impl Into<String>, contents: impl Into<String>, opts: ContainerWithNewFileOpts<'a>, ) -> Container

Return a new container snapshot, with a file added to its filesystem with text content

§Arguments
  • path - Path of the new file. May be relative or absolute. Example: “README.md” or “/etc/profile”
  • contents - Contents of the new file. Example: “Hello world!”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_registry_auth( &self, address: impl Into<String>, username: impl Into<String>, secret: impl IntoID<SecretId>, ) -> Container

Attach credentials for future publishing to a registry. Use in combination with publish

§Arguments
  • address - The image address that needs authentication. Same format as “docker push”. Example: “registry.dagger.io/dagger:latest”
  • username - The username to authenticate with. Example: “alice”
  • secret - The API key, password or token to authenticate to this registry
Source

pub fn with_rootfs(&self, directory: impl IntoID<DirectoryId>) -> Container

Change the container’s root filesystem. The previous root filesystem will be lost.

§Arguments
  • directory - The new root filesystem.
Source

pub fn with_secret_variable( &self, name: impl Into<String>, secret: impl IntoID<SecretId>, ) -> Container

Set a new environment variable, using a secret value

§Arguments
  • name - Name of the secret variable (e.g., “API_SECRET”).
  • secret - Identifier of the secret value.
Source

pub fn with_service_binding( &self, alias: impl Into<String>, service: impl IntoID<ServiceId>, ) -> Container

Establish a runtime dependency from a container to a network 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.

§Arguments
  • alias - Hostname that will resolve to the target service (only accessible from within this container)
  • service - The target service

Return a snapshot with a symlink

§Arguments
  • target - Location of the file or directory to link to (e.g., “/existing/file”).
  • link_name - Location where the symbolic link will be created (e.g., “/new-file-link”).
  • opt - optional argument, see inner type for documentation, use _opts to use

Return a snapshot with a symlink

§Arguments
  • target - Location of the file or directory to link to (e.g., “/existing/file”).
  • link_name - Location where the symbolic link will be created (e.g., “/new-file-link”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_unix_socket( &self, path: impl Into<String>, source: impl IntoID<SocketId>, ) -> Container

Retrieves this container plus a socket forwarded to the given Unix socket path.

§Arguments
  • path - Location of the forwarded Unix socket (e.g., “/tmp/socket”).
  • source - Identifier of the socket to forward.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_unix_socket_opts<'a>( &self, path: impl Into<String>, source: impl IntoID<SocketId>, opts: ContainerWithUnixSocketOpts<'a>, ) -> Container

Retrieves this container plus a socket forwarded to the given Unix socket path.

§Arguments
  • path - Location of the forwarded Unix socket (e.g., “/tmp/socket”).
  • source - Identifier of the socket to forward.
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_user(&self, name: impl Into<String>) -> Container

Retrieves this container with a different command user.

§Arguments
  • name - The user to set (e.g., “root”).
Source

pub fn with_workdir(&self, path: impl Into<String>) -> Container

Change the container’s working directory. Like WORKDIR in Dockerfile.

§Arguments
  • path - The path to set as the working directory (e.g., “/app”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn with_workdir_opts( &self, path: impl Into<String>, opts: ContainerWithWorkdirOpts, ) -> Container

Change the container’s working directory. Like WORKDIR in Dockerfile.

§Arguments
  • path - The path to set as the working directory (e.g., “/app”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_annotation(&self, name: impl Into<String>) -> Container

Retrieves this container minus the given OCI annotation.

§Arguments
  • name - The name of the annotation.
Source

pub fn without_default_args(&self) -> Container

Remove the container’s default arguments.

Source

pub fn without_directory(&self, path: impl Into<String>) -> Container

Return a new container snapshot, with a directory removed from its filesystem

§Arguments
  • path - Location of the directory to remove (e.g., “.github/”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_directory_opts( &self, path: impl Into<String>, opts: ContainerWithoutDirectoryOpts, ) -> Container

Return a new container snapshot, with a directory removed from its filesystem

§Arguments
  • path - Location of the directory to remove (e.g., “.github/”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_entrypoint(&self) -> Container

Reset the container’s OCI entrypoint.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_entrypoint_opts( &self, opts: ContainerWithoutEntrypointOpts, ) -> Container

Reset the container’s OCI entrypoint.

§Arguments
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_env_variable(&self, name: impl Into<String>) -> Container

Retrieves this container minus the given environment variable.

§Arguments
  • name - The name of the environment variable (e.g., “HOST”).
Source

pub fn without_exposed_port(&self, port: isize) -> Container

Unexpose a previously exposed port.

§Arguments
  • port - Port number to unexpose
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_exposed_port_opts( &self, port: isize, opts: ContainerWithoutExposedPortOpts, ) -> Container

Unexpose a previously exposed port.

§Arguments
  • port - Port number to unexpose
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_file(&self, path: impl Into<String>) -> Container

Retrieves this container with the file at the given path removed.

§Arguments
  • path - Location of the file to remove (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_file_opts( &self, path: impl Into<String>, opts: ContainerWithoutFileOpts, ) -> Container

Retrieves this container with the file at the given path removed.

§Arguments
  • path - Location of the file to remove (e.g., “/file.txt”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_files(&self, paths: Vec<impl Into<String>>) -> Container

Return a new container spanshot with specified files removed

§Arguments
  • paths - Paths of the files to remove. Example: [“foo.txt, “/root/.ssh/config”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_files_opts( &self, paths: Vec<impl Into<String>>, opts: ContainerWithoutFilesOpts, ) -> Container

Return a new container spanshot with specified files removed

§Arguments
  • paths - Paths of the files to remove. Example: [“foo.txt, “/root/.ssh/config”
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_label(&self, name: impl Into<String>) -> Container

Retrieves this container minus the given environment label.

§Arguments
  • name - The name of the label to remove (e.g., “org.opencontainers.artifact.created”).
Source

pub fn without_mount(&self, path: impl Into<String>) -> Container

Retrieves this container after unmounting everything at the given path.

§Arguments
  • path - Location of the cache directory (e.g., “/root/.npm”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_mount_opts( &self, path: impl Into<String>, opts: ContainerWithoutMountOpts, ) -> Container

Retrieves this container after unmounting everything at the given path.

§Arguments
  • path - Location of the cache directory (e.g., “/root/.npm”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_registry_auth(&self, address: impl Into<String>) -> Container

Retrieves this container without the registry authentication of a given address.

§Arguments
  • address - Registry’s address to remove the authentication from.

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

Source

pub fn without_secret_variable(&self, name: impl Into<String>) -> Container

Retrieves this container minus the given environment variable containing the secret.

§Arguments
  • name - The name of the environment variable (e.g., “HOST”).
Source

pub fn without_unix_socket(&self, path: impl Into<String>) -> Container

Retrieves this container with a previously added Unix socket removed.

§Arguments
  • path - Location of the socket to remove (e.g., “/tmp/socket”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_unix_socket_opts( &self, path: impl Into<String>, opts: ContainerWithoutUnixSocketOpts, ) -> Container

Retrieves this container with a previously added Unix socket removed.

§Arguments
  • path - Location of the socket to remove (e.g., “/tmp/socket”).
  • opt - optional argument, see inner type for documentation, use _opts to use
Source

pub fn without_user(&self) -> Container

Retrieves this container with an unset command user. Should default to root.

Source

pub fn without_workdir(&self) -> Container

Unset the container’s working directory. Should default to “/”.

Source

pub async fn workdir(&self) -> Result<String, DaggerError>

Retrieves the working directory for all commands.

Trait Implementations§

Source§

impl Clone for Container

Source§

fn clone(&self) -> Container

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl IntoID<ContainerId> for Container

Source§

fn into_id( self, ) -> Pin<Box<dyn Future<Output = Result<ContainerId, DaggerError>> + Send>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,