DockerSdk
the .NET SDK for Docker
Properties | List of all members
DockerSdk.Containers.CreateContainerOptions Class Reference

Settings for how to create a container and how it should behave. More...

Properties

static CreateContainerOptions CommandLineDefaults [get]
 Gets options that are equivalent to the defaults for the docker container create command. More...
 
string?[] Command [get, set]
 Gets or sets an override to the command that the container runs when it starts. More...
 
string? DomainName [get, set]
 Gets or sets the domain name to use for the container. More...
 
string?[] Entrypoint [get, set]
 Gets or sets an override to the command that the container runs when it starts. More...
 
Dictionary< string, string?> EnvironmentVariables = new() [get]
 Gets a Dictionary<TKey, TValue> for setting environment variables in the container. The key is the environment variable's name, and the value is the environment variable's value. If the value is null, the environment variable will be unset, which is different than the environment variable being blank. More...
 
ContainerExitAction ExitAction = ContainerExitAction.None [get, set]
 Gets or sets the action to perform when the container exits. The default is to do nothing. More...
 
string? Hostname [get, set]
 Gets or sets the hostname to use for the container. More...
 
string? IsolationTech [get, set]
 Gets or sets a value indicating which isolation technology to apply to the container. This property is only applicable on Windows hosts. Available values are: "default", "process", and "hyperv". More...
 
int? MaximumRetriesCount [get, set]
 Gets or sets the upper limit on how many times Docker should attempt to restart. This property only applies if ExitAction is set to ContainerExitAction.RestartOnFailure. More...
 
string? Name [get, set]
 Gets or sets the name to give to the container. If this is null, Docker will assign a random name. More...
 
List< PortBindingPortBindings = new() [get]
 Gets a list of port bindings to apply to the container. More...
 
PullImageCondition PullCondition = PullImageCondition.Never [get, set]
 Gets or sets a value indicating whether to pull the image prior to creating the container, and–if so–under what conditions. The default is to never pull the image, which means that the container creation operation will throw an ImageNotFoundException exception if the image is not already present. More...
 
string? User [get, set]
 Gets or sets a value indicating which user the container will run commands as. If this is null, it defaults to the USER from the dockerfile, which in turn defaults to root. More...
 
bool DisableNetworking [get, set]
 Gets or sets a value indicating whether to disable all networking within the container. The default is false. More...
 
Dictionary< string, string > Labels = new() [get]
 Gets a Dictionary<TKey, TValue> for setting labels on the container. More...
 
ISet< NetworkReference > Networks = new HashSet<NetworkReference>() [get]
 Gets the set of networks to attach to the container. In additiona to the networks mentioned here, Docker may also attach the built-in network named "bridge". More...
 

Detailed Description

Settings for how to create a container and how it should behave.

Property Documentation

◆ Command

string? [] DockerSdk.Containers.CreateContainerOptions.Command
getset

Gets or sets an override to the command that the container runs when it starts.

This is approximately equivalent to the command argument when calling the Docker CLI as docker run imagecommand, and is closely related to the CMD directive in Dockerfiles. The exact behavior of the command depends on the image. See the image's documentation for how it's meant to be used.

This setting uses the "exec" form.

See also
Entrypoint

◆ CommandLineDefaults

CreateContainerOptions DockerSdk.Containers.CreateContainerOptions.CommandLineDefaults
staticget

Gets options that are equivalent to the defaults for the docker container create command.

◆ DisableNetworking

bool DockerSdk.Containers.CreateContainerOptions.DisableNetworking
getset

Gets or sets a value indicating whether to disable all networking within the container. The default is false.

◆ DomainName

string? DockerSdk.Containers.CreateContainerOptions.DomainName
getset

Gets or sets the domain name to use for the container.

◆ Entrypoint

string? [] DockerSdk.Containers.CreateContainerOptions.Entrypoint
getset

Gets or sets an override to the command that the container runs when it starts.

For most purposes you should leave this null and use Command instead. Typically you would only use this for troubleshooting purposes.

This is approximately equivalent to the –entrypoint parameter of the Docker CLI's docker run command, and is closely related to the ENTRYPOINT directive in Dockerfiles. The exact behavior of the command depends on the image. See the image's documentation for how it's meant to be used.

This setting uses the "exec" form.

See also
Command

◆ EnvironmentVariables

Dictionary<string, string?> DockerSdk.Containers.CreateContainerOptions.EnvironmentVariables = new()
get

Gets a Dictionary<TKey, TValue> for setting environment variables in the container. The key is the environment variable's name, and the value is the environment variable's value. If the value is null, the environment variable will be unset, which is different than the environment variable being blank.

◆ ExitAction

ContainerExitAction DockerSdk.Containers.CreateContainerOptions.ExitAction = ContainerExitAction.None
getset

Gets or sets the action to perform when the container exits. The default is to do nothing.

Docker will wait 100ms before restarting the first time, then doubling each subsequent time.

See also
MaximumRetriesCount

◆ Hostname

string? DockerSdk.Containers.CreateContainerOptions.Hostname
getset

Gets or sets the hostname to use for the container.

◆ IsolationTech

string? DockerSdk.Containers.CreateContainerOptions.IsolationTech
getset

Gets or sets a value indicating which isolation technology to apply to the container. This property is only applicable on Windows hosts. Available values are: "default", "process", and "hyperv".

◆ Labels

Dictionary<string, string> DockerSdk.Containers.CreateContainerOptions.Labels = new()
get

Gets a Dictionary<TKey, TValue> for setting labels on the container.

◆ MaximumRetriesCount

int? DockerSdk.Containers.CreateContainerOptions.MaximumRetriesCount
getset

Gets or sets the upper limit on how many times Docker should attempt to restart. This property only applies if ExitAction is set to ContainerExitAction.RestartOnFailure.

See also
ExitAction

◆ Name

string? DockerSdk.Containers.CreateContainerOptions.Name
getset

Gets or sets the name to give to the container. If this is null, Docker will assign a random name.

◆ Networks

ISet<NetworkReference> DockerSdk.Containers.CreateContainerOptions.Networks = new HashSet<NetworkReference>()
get

Gets the set of networks to attach to the container. In additiona to the networks mentioned here, Docker may also attach the built-in network named "bridge".

◆ PortBindings

List<PortBinding> DockerSdk.Containers.CreateContainerOptions.PortBindings = new()
get

Gets a list of port bindings to apply to the container.

A port binding connects a port within the container to a port on the host.

◆ PullCondition

PullImageCondition DockerSdk.Containers.CreateContainerOptions.PullCondition = PullImageCondition.Never
getset

Gets or sets a value indicating whether to pull the image prior to creating the container, and–if so–under what conditions. The default is to never pull the image, which means that the container creation operation will throw an ImageNotFoundException exception if the image is not already present.

◆ User

string? DockerSdk.Containers.CreateContainerOptions.User
getset

Gets or sets a value indicating which user the container will run commands as. If this is null, it defaults to the USER from the dockerfile, which in turn defaults to root.

This may be either a user name or a user ID. Optionally, it may also include a group name or group ID, separated from the user with a colon. (For example, "root:root".) Note that when specifying a group for the user, the user will have only the specified group membership. Any other configured group memberships will be ignored.

If this value doesn't specify a group, and the user doesn't have a primary group, the default is the root group.


The documentation for this class was generated from the following file: