DockerfileBuildOptions Class

Options for building an image from a Dockerfile. Pass them to ImageSource.FromDockerfile, which copies them: later changes do not affect the image source.

public sealed class DockerfileBuildOptions

Constructors

NameDescription
DockerfileBuildOptions()

DockerfileBuildOptions()

DockerfileBuildOptions.cs
public DockerfileBuildOptions()

No documentation is available.

Properties

NameDescription
BuildArgumentsGets the build-time variables, the values of the ARG instructions of the Dockerfile (--build-arg).
LabelsGets the labels added to the built image.
NoCacheGets or sets a value indicating whether the build ignores the build cache (--no-cache).
PlatformGets or sets the platform to build the image for, such as linux/amd64 (--platform). When null, ContainerDefinition.Platform is used.
PullGets or sets a value indicating whether the build pulls a newer version of the base images, even when they are on the machine (--pull).
TagGets or sets the name the image is tagged with, such as my-app:test. When null, the image gets a random name and is removed with the container.
TargetGets or sets the stage of a multi-stage Dockerfile to build (--target). When null, the last stage is built.

Gets the build-time variables, the values of the ARG instructions of the Dockerfile (--build-arg).

public IDictionary<string, string> BuildArguments { get; }

Gets the labels added to the built image.

public IDictionary<string, string> Labels { get; }

Gets or sets a value indicating whether the build ignores the build cache (--no-cache).

public bool NoCache { get; set; }

Property value

bool

Gets or sets the platform to build the image for, such as linux/amd64 (--platform). When null, ContainerDefinition.Platform is used.

public string? Platform { get; set; }

Property value

string?

Gets or sets a value indicating whether the build pulls a newer version of the base images, even when they are on the machine (--pull).

public bool Pull { get; set; }

Property value

bool

Gets or sets the name the image is tagged with, such as my-app:test. When null, the image gets a random name and is removed with the container.

public string? Tag { get; set; }

Property value

string?

Remarks

An image with a tag of your choosing belongs to you: it is neither removed with the container nor by ContainerRuntime.CleanupAsync. Every build replaces it, and the build cache of the runtime makes a build of unchanged sources fast without leaving a new image behind.

Gets or sets the stage of a multi-stage Dockerfile to build (--target). When null, the last stage is built.

public string? Target { get; set; }

Property value

string?