Show / Hide Table of Contents

Class Container

Manages the lifecycle of a Docker container.

Example Usage

using Pulumi;
using Docker = Pulumi.Docker;

class MyStack : Stack
{
public MyStack()
{
    // Find the latest Ubuntu precise image.
    var ubuntuRemoteImage = new Docker.RemoteImage("ubuntuRemoteImage", new Docker.RemoteImageArgs
    {
        Name = "ubuntu:precise",
    });
    // Start a container
    var ubuntuContainer = new Docker.Container("ubuntuContainer", new Docker.ContainerArgs
    {
        Image = ubuntuRemoteImage.Latest,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
Container
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Docker
Assembly: Pulumi.Docker.dll
Syntax
public class Container : CustomResource

Constructors

View Source

Container(String, ContainerArgs, CustomResourceOptions)

Create a Container resource with the given unique name, arguments, and options.

Declaration
public Container(string name, ContainerArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ContainerArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Attach

If true attach to the container after its creation and waits the end of his execution.

Declaration
public Output<bool?> Attach { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Bridge

The network bridge of the container as read from its NetworkSettings.

Declaration
public Output<string> Bridge { get; }
Property Value
Type Description
Output<System.String>
View Source

Capabilities

See Capabilities below for details.

Declaration
public Output<ContainerCapabilities> Capabilities { get; }
Property Value
Type Description
Output<ContainerCapabilities>
View Source

Command

The command to use to start the container. For example, to run /usr/bin/myprogram -f baz.conf set the command to be [&quot;/usr/bin/myprogram&quot;, &quot;-f&quot;, &quot;baz.conf&quot;].

Declaration
public Output<ImmutableArray<string>> Command { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

ContainerLogs

The logs of the container if its execution is done (attach must be disabled).

Declaration
public Output<string> ContainerLogs { get; }
Property Value
Type Description
Output<System.String>
View Source

CpuSet

A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.

Declaration
public Output<string> CpuSet { get; }
Property Value
Type Description
Output<System.String>
View Source

CpuShares

CPU shares (relative weight) for the container.

Declaration
public Output<int?> CpuShares { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

DestroyGraceSeconds

If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.

Declaration
public Output<int?> DestroyGraceSeconds { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Devices

See Devices below for details.

Declaration
public Output<ImmutableArray<ContainerDevice>> Devices { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerDevice>>
View Source

Dns

Set of DNS servers.

Declaration
public Output<ImmutableArray<string>> Dns { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

DnsOpts

Set of DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.

Declaration
public Output<ImmutableArray<string>> DnsOpts { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

DnsSearches

Set of DNS search domains that are used when bare unqualified hostnames are used inside of the container.

Declaration
public Output<ImmutableArray<string>> DnsSearches { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Domainname

Domain name of the container.

Declaration
public Output<string> Domainname { get; }
Property Value
Type Description
Output<System.String>
View Source

Entrypoints

The command to use as the Entrypoint for the container. The Entrypoint allows you to configure a container to run as an executable. For example, to run /usr/bin/myprogram when starting a container, set the entrypoint to be [&quot;/usr/bin/myprogram&quot;].

Declaration
public Output<ImmutableArray<string>> Entrypoints { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Envs

Environment variables to set.

Declaration
public Output<ImmutableArray<string>> Envs { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

ExitCode

The exit code of the container if its execution is done (must_run must be disabled).

Declaration
public Output<int> ExitCode { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Gateway

Deprecated: Use network_data instead. The network gateway of the container as read from its NetworkSettings.

Declaration
public Output<string> Gateway { get; }
Property Value
Type Description
Output<System.String>
View Source

GroupAdds

Add additional groups to run as.

Declaration
public Output<ImmutableArray<string>> GroupAdds { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

Healthcheck

See Healthcheck below for details.

Declaration
public Output<ContainerHealthcheck> Healthcheck { get; }
Property Value
Type Description
Output<ContainerHealthcheck>
View Source

Hostname

Hostname of the container.

Declaration
public Output<string> Hostname { get; }
Property Value
Type Description
Output<System.String>
View Source

Hosts

Hostname to add.

Declaration
public Output<ImmutableArray<ContainerHost>> Hosts { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerHost>>
View Source

Image

The ID of the image to back this container. The easiest way to get this value is to use the docker..RemoteImage resource as is shown in the example above.

Declaration
public Output<string> Image { get; }
Property Value
Type Description
Output<System.String>
View Source

IpAddress

Deprecated: Use network_data instead. The IP address of the container's first network it.

Declaration
public Output<string> IpAddress { get; }
Property Value
Type Description
Output<System.String>
View Source

IpcMode

IPC sharing mode for the container. Possible values are: none, private, shareable, container:&lt;name|id> or host.

Declaration
public Output<string> IpcMode { get; }
Property Value
Type Description
Output<System.String>
View Source

IpPrefixLength

Deprecated: Use network_data instead. The IP prefix length of the container as read from its NetworkSettings.

Declaration
public Output<int> IpPrefixLength { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Labels

Adding labels.

Declaration
public Output<ImmutableArray<ContainerLabel>> Labels { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerLabel>>
View Source

Links

Set of links for link based connectivity between containers that are running on the same host.

Declaration
public Output<ImmutableArray<string>> Links { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

LogDriver

The logging driver to use for the container. Defaults to "json-file".

Declaration
public Output<string> LogDriver { get; }
Property Value
Type Description
Output<System.String>
View Source

LogOpts

Key/value pairs to use as options for the logging driver.

Declaration
public Output<ImmutableDictionary<string, object>> LogOpts { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>
View Source

Logs

Save the container logs (attach must be enabled).

Declaration
public Output<bool?> Logs { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

MaxRetryCount

The maximum amount of times to an attempt a restart when restart is set to "on-failure"

Declaration
public Output<int?> MaxRetryCount { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Memory

The memory limit for the container in MBs.

Declaration
public Output<int?> Memory { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

MemorySwap

Declaration
public Output<int?> MemorySwap { get; }
Property Value
Type Description
Output<System.Nullable<System.Int32>>
View Source

Mounts

See Mounts below for details.

Declaration
public Output<ImmutableArray<ContainerMount>> Mounts { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerMount>>
View Source

MustRun

Declaration
public Output<bool?> MustRun { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Name

Declaration
public Output<string> Name { get; }
Property Value
Type Description
Output<System.String>
View Source

NetworkAliases

Network aliases of the container for user-defined networks only. Deprecated: use networks_advanced instead.

Declaration
public Output<ImmutableArray<string>> NetworkAliases { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

NetworkDatas

(Map of a block) The IP addresses of the container on each network. Key are the network names, values are the IP addresses.

Declaration
public Output<ImmutableArray<ContainerNetworkData>> NetworkDatas { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerNetworkData>>
View Source

NetworkMode

Network mode of the container.

Declaration
public Output<string> NetworkMode { get; }
Property Value
Type Description
Output<System.String>
View Source

Networks

Id of the networks in which the container is. Deprecated: use networks_advanced instead.

Declaration
public Output<ImmutableArray<string>> Networks { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

NetworksAdvanced

See Networks Advanced below for details. If this block has priority to the deprecated network_alias and network properties.

Declaration
public Output<ImmutableArray<ContainerNetworksAdvanced>> NetworksAdvanced { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerNetworksAdvanced>>
View Source

PidMode

The PID (Process) Namespace mode for the container. Either container:&lt;name|id> or host.

Declaration
public Output<string> PidMode { get; }
Property Value
Type Description
Output<System.String>
View Source

Ports

See Ports below for details.

Declaration
public Output<ImmutableArray<ContainerPort>> Ports { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerPort>>
View Source

Privileged

Run container in privileged mode.

Declaration
public Output<bool?> Privileged { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

PublishAllPorts

Publish all ports of the container.

Declaration
public Output<bool?> PublishAllPorts { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ReadOnly

If true, this volume will be readonly. Defaults to false.

Declaration
public Output<bool?> ReadOnly { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Restart

The restart policy for the container. Must be one of "no", "on-failure", "always", "unless-stopped".

Declaration
public Output<string> Restart { get; }
Property Value
Type Description
Output<System.String>
View Source

Rm

Declaration
public Output<bool?> Rm { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

ShmSize

Size of /dev/shm in MBs.

Declaration
public Output<int> ShmSize { get; }
Property Value
Type Description
Output<System.Int32>
View Source

Start

If true, then the Docker container will be started after creation. If false, then the container is only created.

Declaration
public Output<bool?> Start { get; }
Property Value
Type Description
Output<System.Nullable<System.Boolean>>
View Source

Sysctls

A map of kernel parameters (sysctls) to set in the container.

Declaration
public Output<ImmutableDictionary<string, object>> Sysctls { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>
View Source

Tmpfs

A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.

Declaration
public Output<ImmutableDictionary<string, object>> Tmpfs { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>>
View Source

Ulimits

See Ulimits below for details.

Declaration
public Output<ImmutableArray<ContainerUlimit>> Ulimits { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerUlimit>>
View Source

Uploads

See File Upload below for details.

Declaration
public Output<ImmutableArray<ContainerUpload>> Uploads { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerUpload>>
View Source

User

User used for run the first process. Format is user or user:group which user and group can be passed literraly or by name.

Declaration
public Output<string> User { get; }
Property Value
Type Description
Output<System.String>
View Source

UsernsMode

Sets the usernamespace mode for the container when usernamespace remapping option is enabled.

Declaration
public Output<string> UsernsMode { get; }
Property Value
Type Description
Output<System.String>
View Source

Volumes

See Volumes below for details.

Declaration
public Output<ImmutableArray<ContainerVolume>> Volumes { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ContainerVolume>>
View Source

WorkingDir

The working directory for commands to run in

Declaration
public Output<string> WorkingDir { get; }
Property Value
Type Description
Output<System.String>

Methods

View Source

Get(String, Input<String>, ContainerState, CustomResourceOptions)

Get an existing Container resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static Container Get(string name, Input<string> id, ContainerState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ContainerState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
Container
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.