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

Returns a File representing the container serialized to a tarball.

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

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

Returns a File representing the container serialized to a tarball.

§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 default_args(&self) -> Result<Vec<String>, DaggerError>

Retrieves default arguments for future commands.

Source

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

Retrieves a directory at the given path. 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

Retrieves a directory at the given path. 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>

Retrieves entrypoint to be prepended to the arguments of all commands.

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 exit_code(&self) -> Result<isize, DaggerError>

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

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 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

Initializes this container from a pulled base image.

§Arguments
  • address - Image’s address from its registry.

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

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>

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 - Registry’s address to publish the image to.

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

  • 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>

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 - Registry’s address to publish the image to.

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

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

pub fn rootfs(&self) -> Directory

Retrieves this container’s root filesystem. Mounts are not included.

Source

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

The error stream of the last executed command. Returns an error if no command was set.

Source

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

The output stream of the last executed command. Returns an error if no command was set.

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.

§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

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

§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

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

§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

Retrieves this container but with a different command entrypoint.

§Arguments
  • args - Entrypoint to use for future executions (e.g., [“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

Retrieves this container but with a different command entrypoint.

§Arguments
  • args - Entrypoint to use for future executions (e.g., [“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

Retrieves this container plus the given environment variable.

§Arguments
  • name - The name of the environment variable (e.g., “HOST”).
  • value - The 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

Retrieves this container plus the given environment variable.

§Arguments
  • name - The name of the environment variable (e.g., “HOST”).
  • value - The 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

Retrieves this container after executing the specified command inside it.

§Arguments
  • args - Command to run instead of the container’s default command (e.g., [“go”, “run”, “main.go”]).

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

  • 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

Retrieves this container after executing the specified command inside it.

§Arguments
  • args - Command to run instead of the container’s default command (e.g., [“go”, “run”, “main.go”]).

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

  • 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. 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
  • 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. 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
  • 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

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

§Arguments
  • path - Location of the copied file (e.g., “/tmp/file.txt”).
  • source - Identifier of the file to copy.
  • 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

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

§Arguments
  • path - Location of the copied file (e.g., “/tmp/file.txt”).
  • source - Identifier of the file to copy.
  • 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

Retrieves this container plus a new file written at the given path.

§Arguments
  • path - Location of the written file (e.g., “/tmp/file.txt”).
  • contents - Content of the file to write (e.g., “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

Retrieves this container plus a new file written at the given path.

§Arguments
  • path - Location of the written file (e.g., “/tmp/file.txt”).
  • contents - Content of the file to write (e.g., “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

Retrieves this container with a registry authentication for a given address.

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

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

  • username - The username of the registry’s account (e.g., “Dagger”).
  • secret - The API key, password or token to authenticate to this registry.
Source

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

Retrieves the container with the given directory mounted to /.

§Arguments
  • directory - Directory to mount.
Source

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

Retrieves this container plus an env variable containing the given secret.

§Arguments
  • name - The name of the secret variable (e.g., “API_SECRET”).
  • secret - The 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 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.

§Arguments
  • alias - A name that can be used to reach the service from the container
  • service - Identifier of the service container
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

Retrieves this container with a different working directory.

§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

Retrieves this container with a different working directory.

§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

Retrieves this container with unset default arguments for future commands.

Source

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

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

§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

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

§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

Retrieves this container with an unset command entrypoint.

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

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

Retrieves this container with an unset command 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

Retrieves this container with the files at the given paths removed.

§Arguments
  • paths - Location of the files to remove (e.g., [“/file.txt”]).
  • 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

Retrieves this container with the files at the given paths removed.

§Arguments
  • paths - Location of the files to remove (e.g., [“/file.txt”]).
  • 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

Retrieves this container with an unset 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 copy 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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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