Package @pulumi/docker

var docker = require("@pulumi/docker");
import * as docker from "@pulumi/docker";

Modules ▾

class Container

extends CustomResource

Manages the lifecycle of a Docker container.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

// Find the latest Ubuntu precise image.
const ubuntuRemoteImage = new docker.RemoteImage("ubuntu", {});
// Start a container
const ubuntuContainer = new docker.Container("ubuntu", {
    image: ubuntuRemoteImage.latest,
});

constructor

new Container(name: string, args: ContainerArgs, opts?: pulumi.CustomResourceOptions)

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

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: ContainerState, opts?: pulumi.CustomResourceOptions): Container

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

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property attach

public attach: pulumi.Output<boolean | undefined>;

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

property bridge

public bridge: pulumi.Output<string>;

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

property capabilities

public capabilities: pulumi.Output<{
    adds: string[];
    drops: string[];
} | undefined>;

See Capabilities below for details.

property command

public command: pulumi.Output<string[] | undefined>;

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

property containerLogs

public containerLogs: pulumi.Output<string>;

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

property cpuSet

public cpuSet: pulumi.Output<string | undefined>;

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

property cpuShares

public cpuShares: pulumi.Output<number | undefined>;

CPU shares (relative weight) for the container.

property destroyGraceSeconds

public destroyGraceSeconds: pulumi.Output<number | undefined>;

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

property devices

public devices: pulumi.Output<{
    containerPath: string;
    hostPath: string;
    permissions: string;
}[] | undefined>;

See Devices below for details.

property dns

public dns: pulumi.Output<string[] | undefined>;

Set of DNS servers.

property dnsOpts

public dnsOpts: pulumi.Output<string[] | undefined>;

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

property dnsSearches

public dnsSearches: pulumi.Output<string[] | undefined>;

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

property domainname

public domainname: pulumi.Output<string | undefined>;

Domain name of the container.

property entrypoints

public entrypoints: pulumi.Output<string[] | undefined>;

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 ["/usr/bin/myprogram"].

property envs

public envs: pulumi.Output<string[] | undefined>;

Environment variables to set.

property exitCode

public exitCode: pulumi.Output<number>;

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

property gateway

public gateway: pulumi.Output<string>;

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

property healthcheck

public healthcheck: pulumi.Output<{
    interval: string;
    retries: number;
    startPeriod: string;
    tests: string[];
    timeout: string;
} | undefined>;

See Healthcheck below for details.

property hostname

public hostname: pulumi.Output<string | undefined>;

Hostname of the container.

property hosts

public hosts: pulumi.Output<{
    host: string;
    ip: string;
}[] | undefined>;

Hostname to add.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property image

public image: pulumi.Output<string>;

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

property ipAddress

public ipAddress: pulumi.Output<string>;

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

property ipPrefixLength

public ipPrefixLength: pulumi.Output<number>;

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

property labels

public labels: pulumi.Output<{[key: string]: any} | undefined>;

Key/value pairs to set as labels on the container.

public links: pulumi.Output<string[] | undefined>;

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

property logDriver

public logDriver: pulumi.Output<string | undefined>;

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

property logOpts

public logOpts: pulumi.Output<{[key: string]: any} | undefined>;

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

property logs

public logs: pulumi.Output<boolean | undefined>;

Save the container logs (attach must be enabled).

property maxRetryCount

public maxRetryCount: pulumi.Output<number | undefined>;

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

property memory

public memory: pulumi.Output<number | undefined>;

The memory limit for the container in MBs.

property memorySwap

public memorySwap: pulumi.Output<number | undefined>;

The total memory limit (memory + swap) for the container in MBs. This setting may compute to -1 after terraform apply if the target host doesn’t support memory swap, when that is the case docker will use a soft limitation.

property mustRun

public mustRun: pulumi.Output<boolean | undefined>;

If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful.

property name

public name: pulumi.Output<string>;

property networkAliases

public networkAliases: pulumi.Output<string[] | undefined>;

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

property networkDatas

public networkDatas: pulumi.Output<{
    gateway: string;
    ipAddress: string;
    ipPrefixLength: number;
    networkName: string;
}[]>;

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

property networkMode

public networkMode: pulumi.Output<string | undefined>;

Network mode of the container.

property networks

public networks: pulumi.Output<string[] | undefined>;

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

property networksAdvanced

public networksAdvanced: pulumi.Output<{
    aliases: string[];
    ipv4Address: string;
    ipv6Address: string;
    name: string;
}[] | undefined>;

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

property pidMode

public pidMode: pulumi.Output<string | undefined>;

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

property ports

public ports: pulumi.Output<{
    external: number;
    internal: number;
    ip: string;
    protocol: string;
}[] | undefined>;

See Ports below for details.

property privileged

public privileged: pulumi.Output<boolean | undefined>;

Run container in privileged mode.

property publishAllPorts

public publishAllPorts: pulumi.Output<boolean | undefined>;

Publish all ports of the container.

property restart

public restart: pulumi.Output<string | undefined>;

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

property rm

public rm: pulumi.Output<boolean | undefined>;

If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation.

property start

public start: pulumi.Output<boolean | undefined>;

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

property ulimits

public ulimits: pulumi.Output<{
    hard: number;
    name: string;
    soft: number;
}[] | undefined>;

See Ulimits below for details.

property uploads

public uploads: pulumi.Output<{
    content: string;
    executable: boolean;
    file: string;
}[] | undefined>;

See File Upload below for details.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

property user

public user: pulumi.Output<string | undefined>;

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

property usernsMode

public usernsMode: pulumi.Output<string | undefined>;

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

property volumes

public volumes: pulumi.Output<{
    containerPath: string;
    fromContainer: string;
    hostPath: string;
    readOnly: boolean;
    volumeName: string;
}[] | undefined>;

See Volumes below for details.

class Image

extends ComponentResource

A docker.Image resource represents a Docker image built locally which is published and made available via a remote Docker registry. This can be used to ensure that a Docker source directory from a local deployment environment is built and pushed to a cloud-hosted Docker registry as part of a Pulumi deployment, so that it can be referenced as an image input from other cloud services that reference Docker images - including Kubernetes Pods, AWS ECS Tasks, and Azure Container Instances.

constructor

new Image(name: string, args: ImageArgs, opts?: pulumi.ComponentResourceOptions)

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

method registerOutputs

protected registerOutputs(outputs?: Inputs | Promise<Inputs> | Output<Inputs>): void

property baseImageName

public baseImageName: pulumi.Output<string>;

The base image name that was built and pushed. This does not include the id annotation, so is not pinned to the specific build performed by this docker.Image.

property digest

public digest: pulumi.Output<string | undefined>;

property id

public id: pulumi.Output<string>;

property imageName

public imageName: pulumi.Output<string>;

The unique pinned image name on the remote repository.

property registryServer

public registryServer: pulumi.Output<string | undefined>;

The server the image is located at.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Network

extends CustomResource

Manages a Docker Network. This can be used alongside docker_container to create virtual networks within the docker environment.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

// Create a new docker network
const privateNetwork = new docker.Network("private_network", {});

constructor

new Network(name: string, args?: NetworkArgs, opts?: pulumi.CustomResourceOptions)

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

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NetworkState, opts?: pulumi.CustomResourceOptions): Network

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

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property attachable

public attachable: pulumi.Output<boolean | undefined>;

Enable manual container attachment to the network. Defaults to false.

property checkDuplicate

public checkDuplicate: pulumi.Output<boolean | undefined>;

Requests daemon to check for networks with same name.

property driver

public driver: pulumi.Output<string>;

Name of the network driver to use. Defaults to bridge driver.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property ingress

public ingress: pulumi.Output<boolean | undefined>;

Create swarm routing-mesh network. Defaults to false.

property internal

public internal: pulumi.Output<boolean>;

Restrict external access to the network. Defaults to false.

property ipamConfigs

public ipamConfigs: pulumi.Output<{
    auxAddress: {[key: string]: any};
    gateway: string;
    ipRange: string;
    subnet: string;
}[] | undefined>;

See IPAM config below for details.

property ipamDriver

public ipamDriver: pulumi.Output<string | undefined>;

Driver used by the custom IP scheme of the network.

property ipv6

public ipv6: pulumi.Output<boolean | undefined>;

Enable IPv6 networking. Defaults to false.

property labels

public labels: pulumi.Output<{[key: string]: any} | undefined>;

User-defined key/value metadata.

property name

public name: pulumi.Output<string>;

The name of the Docker network.

property options

public options: pulumi.Output<{[key: string]: any}>;

Network specific options to be used by the drivers.

property scope

public scope: pulumi.Output<string>;

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Provider

extends ProviderResource

The provider type for the docker package. By default, resources use package-wide configuration settings, however an explicit Provider instance may be created and passed during resource construction to achieve fine-grained programmatic control over provider settings. See the documentation for more information.

constructor

new Provider(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions)

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

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class RemoteImage

extends CustomResource

Pulls a Docker image to a given Docker host from a Docker Registry.

This resource will not pull new layers of the image automatically unless used in conjunction with docker_registry_image data source to update the pull_triggers field.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

// Find the latest Ubuntu precise image.
const ubuntu = new docker.RemoteImage("ubuntu", {});

Dynamic image

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

const ubuntuRegistryImage = pulumi.output(docker.RegistryImage({
    name: "ubuntu:precise",
}));
const ubuntuRemoteImage = new docker.RemoteImage("ubuntu", {
    pullTriggers: [ubuntuRegistryImage.apply(ubuntuRegistryImage => ubuntuRegistryImage.sha256Digest)],
});

constructor

new RemoteImage(name: string, args: RemoteImageArgs, opts?: pulumi.CustomResourceOptions)

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

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: RemoteImageState, opts?: pulumi.CustomResourceOptions): RemoteImage

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

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property keepLocally

public keepLocally: pulumi.Output<boolean | undefined>;

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

property latest

public latest: pulumi.Output<string>;

property name

public name: pulumi.Output<string>;

The name of the Docker image, including any tags or SHA256 repo digests.

property pullTrigger

public pullTrigger: pulumi.Output<string | undefined>;

Deprecated, use pull_triggers instead.

property pullTriggers

public pullTriggers: pulumi.Output<string[] | undefined>;

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker_registry_image data source to trigger an image update.

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

class Volume

extends CustomResource

Creates and destroys a volume in Docker. This can be used alongside docker_container to prepare volumes that can be shared across containers.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";

// Creates a docker volume "shared_volume".
const sharedVolume = new docker.Volume("shared_volume", {});

constructor

new Volume(name: string, args?: VolumeArgs, opts?: pulumi.CustomResourceOptions)

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

  • name The unique name of the resource.
  • args The arguments to use to populate this resource's properties.
  • opts A bag of options that control this resource's behavior.

method get

public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: VolumeState, opts?: pulumi.CustomResourceOptions): Volume

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

method getProvider

getProvider(moduleMember: string): ProviderResource | undefined

method isInstance

static isInstance(obj: any): boolean

Returns true if the given object is an instance of CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

property driver

public driver: pulumi.Output<string>;

Driver type for the volume (defaults to local).

property driverOpts

public driverOpts: pulumi.Output<{[key: string]: any} | undefined>;

Options specific to the driver.

property id

id: Output<ID>;

id is the provider-assigned unique ID for this managed resource. It is set during deployments and may be missing (undefined) during planning phases.

property labels

public labels: pulumi.Output<{[key: string]: any} | undefined>;

User-defined key/value metadata.

property mountpoint

public mountpoint: pulumi.Output<string>;

property name

public name: pulumi.Output<string>;

The name of the Docker volume (generated if not provided).

property urn

urn: Output<URN>;

urn is the stable logical URN used to distinctly address a resource, both before and after deployments.

function buildAndPushImage

buildAndPushImage(imageName: string, pathOrBuild: pulumi.Input<string | DockerBuild>, repositoryUrl: pulumi.Input<string>, logResource: pulumi.Resource, connectToRegistry?: () => pulumi.Input<Registry>): pulumi.Output<string>

buildAndPushImage will build and push the Dockerfile and context from [pathOrBuild] into the requested docker repo [repositoryUrl]. It returns the unique target image name for the image in the docker repository. During preview this will build the image, and return the target image name, without pushing. During a normal update, it will do the same, as well as tag and push the image.

function buildAndPushImageAsync

buildAndPushImageAsync(baseImageName: string, pathOrBuild: pulumi.Input<string | DockerBuild>, repositoryUrl: pulumi.Input<string>, logResource: pulumi.Resource, connectToRegistry?: () => pulumi.Input<Registry>): Promise<string>

function getEnv

getEnv(vars: string[]): string | undefined

function getEnvBoolean

getEnvBoolean(vars: string[]): boolean | undefined

function getEnvNumber

getEnvNumber(vars: string[]): number | undefined

function requireWithDefault

requireWithDefault<T>(req: () => T, def: T | undefined): T

interface CacheFrom

CacheFrom may be used to specify build stages to use for the Docker build cache. The final image is always implicitly included.

property stages

stages?: pulumi.Input<pulumi.Input<string>[]>;

An optional list of build stages to use for caching. Each build stage in this list will be built explicitly and pushed to the target repository. A given stage’s image will be tagged as “[stage-name]”.

interface ContainerArgs

The set of arguments for constructing a Container resource.

property attach

attach?: pulumi.Input<boolean>;

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

property capabilities

capabilities?: pulumi.Input<{
    adds: pulumi.Input<pulumi.Input<string>[]>;
    drops: pulumi.Input<pulumi.Input<string>[]>;
}>;

See Capabilities below for details.

property command

command?: pulumi.Input<pulumi.Input<string>[]>;

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

property cpuSet

cpuSet?: pulumi.Input<string>;

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

property cpuShares

cpuShares?: pulumi.Input<number>;

CPU shares (relative weight) for the container.

property destroyGraceSeconds

destroyGraceSeconds?: pulumi.Input<number>;

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

property devices

devices?: pulumi.Input<pulumi.Input<{
    containerPath: pulumi.Input<string>;
    hostPath: pulumi.Input<string>;
    permissions: pulumi.Input<string>;
}>[]>;

See Devices below for details.

property dns

dns?: pulumi.Input<pulumi.Input<string>[]>;

Set of DNS servers.

property dnsOpts

dnsOpts?: pulumi.Input<pulumi.Input<string>[]>;

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

property dnsSearches

dnsSearches?: pulumi.Input<pulumi.Input<string>[]>;

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

property domainname

domainname?: pulumi.Input<string>;

Domain name of the container.

property entrypoints

entrypoints?: pulumi.Input<pulumi.Input<string>[]>;

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 ["/usr/bin/myprogram"].

property envs

envs?: pulumi.Input<pulumi.Input<string>[]>;

Environment variables to set.

property healthcheck

healthcheck?: pulumi.Input<{
    interval: pulumi.Input<string>;
    retries: pulumi.Input<number>;
    startPeriod: pulumi.Input<string>;
    tests: pulumi.Input<pulumi.Input<string>[]>;
    timeout: pulumi.Input<string>;
}>;

See Healthcheck below for details.

property hostname

hostname?: pulumi.Input<string>;

Hostname of the container.

property hosts

hosts?: pulumi.Input<pulumi.Input<{
    host: pulumi.Input<string>;
    ip: pulumi.Input<string>;
}>[]>;

Hostname to add.

property image

image: pulumi.Input<string>;

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

property labels

labels?: pulumi.Input<{[key: string]: any}>;

Key/value pairs to set as labels on the container.

links?: pulumi.Input<pulumi.Input<string>[]>;

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

property logDriver

logDriver?: pulumi.Input<string>;

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

property logOpts

logOpts?: pulumi.Input<{[key: string]: any}>;

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

property logs

logs?: pulumi.Input<boolean>;

Save the container logs (attach must be enabled).

property maxRetryCount

maxRetryCount?: pulumi.Input<number>;

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

property memory

memory?: pulumi.Input<number>;

The memory limit for the container in MBs.

property memorySwap

memorySwap?: pulumi.Input<number>;

The total memory limit (memory + swap) for the container in MBs. This setting may compute to -1 after terraform apply if the target host doesn’t support memory swap, when that is the case docker will use a soft limitation.

property mustRun

mustRun?: pulumi.Input<boolean>;

If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful.

property name

name?: pulumi.Input<string>;

property networkAliases

networkAliases?: pulumi.Input<pulumi.Input<string>[]>;

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

property networkMode

networkMode?: pulumi.Input<string>;

Network mode of the container.

property networks

networks?: pulumi.Input<pulumi.Input<string>[]>;

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

property networksAdvanced

networksAdvanced?: pulumi.Input<pulumi.Input<{
    aliases: pulumi.Input<pulumi.Input<string>[]>;
    ipv4Address: pulumi.Input<string>;
    ipv6Address: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]>;

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

property pidMode

pidMode?: pulumi.Input<string>;

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

property ports

ports?: pulumi.Input<pulumi.Input<{
    external: pulumi.Input<number>;
    internal: pulumi.Input<number>;
    ip: pulumi.Input<string>;
    protocol: pulumi.Input<string>;
}>[]>;

See Ports below for details.

property privileged

privileged?: pulumi.Input<boolean>;

Run container in privileged mode.

property publishAllPorts

publishAllPorts?: pulumi.Input<boolean>;

Publish all ports of the container.

property restart

restart?: pulumi.Input<string>;

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

property rm

rm?: pulumi.Input<boolean>;

If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation.

property start

start?: pulumi.Input<boolean>;

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

property ulimits

ulimits?: pulumi.Input<pulumi.Input<{
    hard: pulumi.Input<number>;
    name: pulumi.Input<string>;
    soft: pulumi.Input<number>;
}>[]>;

See Ulimits below for details.

property uploads

uploads?: pulumi.Input<pulumi.Input<{
    content: pulumi.Input<string>;
    executable: pulumi.Input<boolean>;
    file: pulumi.Input<string>;
}>[]>;

See File Upload below for details.

property user

user?: pulumi.Input<string>;

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

property usernsMode

usernsMode?: pulumi.Input<string>;

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

property volumes

volumes?: pulumi.Input<pulumi.Input<{
    containerPath: pulumi.Input<string>;
    fromContainer: pulumi.Input<string>;
    hostPath: pulumi.Input<string>;
    readOnly: pulumi.Input<boolean>;
    volumeName: pulumi.Input<string>;
}>[]>;

See Volumes below for details.

interface ContainerState

Input properties used for looking up and filtering Container resources.

property attach

attach?: pulumi.Input<boolean>;

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

property bridge

bridge?: pulumi.Input<string>;

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

property capabilities

capabilities?: pulumi.Input<{
    adds: pulumi.Input<pulumi.Input<string>[]>;
    drops: pulumi.Input<pulumi.Input<string>[]>;
}>;

See Capabilities below for details.

property command

command?: pulumi.Input<pulumi.Input<string>[]>;

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

property containerLogs

containerLogs?: pulumi.Input<string>;

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

property cpuSet

cpuSet?: pulumi.Input<string>;

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

property cpuShares

cpuShares?: pulumi.Input<number>;

CPU shares (relative weight) for the container.

property destroyGraceSeconds

destroyGraceSeconds?: pulumi.Input<number>;

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

property devices

devices?: pulumi.Input<pulumi.Input<{
    containerPath: pulumi.Input<string>;
    hostPath: pulumi.Input<string>;
    permissions: pulumi.Input<string>;
}>[]>;

See Devices below for details.

property dns

dns?: pulumi.Input<pulumi.Input<string>[]>;

Set of DNS servers.

property dnsOpts

dnsOpts?: pulumi.Input<pulumi.Input<string>[]>;

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

property dnsSearches

dnsSearches?: pulumi.Input<pulumi.Input<string>[]>;

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

property domainname

domainname?: pulumi.Input<string>;

Domain name of the container.

property entrypoints

entrypoints?: pulumi.Input<pulumi.Input<string>[]>;

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 ["/usr/bin/myprogram"].

property envs

envs?: pulumi.Input<pulumi.Input<string>[]>;

Environment variables to set.

property exitCode

exitCode?: pulumi.Input<number>;

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

property gateway

gateway?: pulumi.Input<string>;

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

property healthcheck

healthcheck?: pulumi.Input<{
    interval: pulumi.Input<string>;
    retries: pulumi.Input<number>;
    startPeriod: pulumi.Input<string>;
    tests: pulumi.Input<pulumi.Input<string>[]>;
    timeout: pulumi.Input<string>;
}>;

See Healthcheck below for details.

property hostname

hostname?: pulumi.Input<string>;

Hostname of the container.

property hosts

hosts?: pulumi.Input<pulumi.Input<{
    host: pulumi.Input<string>;
    ip: pulumi.Input<string>;
}>[]>;

Hostname to add.

property image

image?: pulumi.Input<string>;

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

property ipAddress

ipAddress?: pulumi.Input<string>;

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

property ipPrefixLength

ipPrefixLength?: pulumi.Input<number>;

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

property labels

labels?: pulumi.Input<{[key: string]: any}>;

Key/value pairs to set as labels on the container.

links?: pulumi.Input<pulumi.Input<string>[]>;

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

property logDriver

logDriver?: pulumi.Input<string>;

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

property logOpts

logOpts?: pulumi.Input<{[key: string]: any}>;

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

property logs

logs?: pulumi.Input<boolean>;

Save the container logs (attach must be enabled).

property maxRetryCount

maxRetryCount?: pulumi.Input<number>;

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

property memory

memory?: pulumi.Input<number>;

The memory limit for the container in MBs.

property memorySwap

memorySwap?: pulumi.Input<number>;

The total memory limit (memory + swap) for the container in MBs. This setting may compute to -1 after terraform apply if the target host doesn’t support memory swap, when that is the case docker will use a soft limitation.

property mustRun

mustRun?: pulumi.Input<boolean>;

If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful.

property name

name?: pulumi.Input<string>;

property networkAliases

networkAliases?: pulumi.Input<pulumi.Input<string>[]>;

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

property networkDatas

networkDatas?: pulumi.Input<pulumi.Input<{
    gateway: pulumi.Input<string>;
    ipAddress: pulumi.Input<string>;
    ipPrefixLength: pulumi.Input<number>;
    networkName: pulumi.Input<string>;
}>[]>;

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

property networkMode

networkMode?: pulumi.Input<string>;

Network mode of the container.

property networks

networks?: pulumi.Input<pulumi.Input<string>[]>;

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

property networksAdvanced

networksAdvanced?: pulumi.Input<pulumi.Input<{
    aliases: pulumi.Input<pulumi.Input<string>[]>;
    ipv4Address: pulumi.Input<string>;
    ipv6Address: pulumi.Input<string>;
    name: pulumi.Input<string>;
}>[]>;

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

property pidMode

pidMode?: pulumi.Input<string>;

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

property ports

ports?: pulumi.Input<pulumi.Input<{
    external: pulumi.Input<number>;
    internal: pulumi.Input<number>;
    ip: pulumi.Input<string>;
    protocol: pulumi.Input<string>;
}>[]>;

See Ports below for details.

property privileged

privileged?: pulumi.Input<boolean>;

Run container in privileged mode.

property publishAllPorts

publishAllPorts?: pulumi.Input<boolean>;

Publish all ports of the container.

property restart

restart?: pulumi.Input<string>;

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

property rm

rm?: pulumi.Input<boolean>;

If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation.

property start

start?: pulumi.Input<boolean>;

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

property ulimits

ulimits?: pulumi.Input<pulumi.Input<{
    hard: pulumi.Input<number>;
    name: pulumi.Input<string>;
    soft: pulumi.Input<number>;
}>[]>;

See Ulimits below for details.

property uploads

uploads?: pulumi.Input<pulumi.Input<{
    content: pulumi.Input<string>;
    executable: pulumi.Input<boolean>;
    file: pulumi.Input<string>;
}>[]>;

See File Upload below for details.

property user

user?: pulumi.Input<string>;

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

property usernsMode

usernsMode?: pulumi.Input<string>;

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

property volumes

volumes?: pulumi.Input<pulumi.Input<{
    containerPath: pulumi.Input<string>;
    fromContainer: pulumi.Input<string>;
    hostPath: pulumi.Input<string>;
    readOnly: pulumi.Input<boolean>;
    volumeName: pulumi.Input<string>;
}>[]>;

See Volumes below for details.

interface DockerBuild

DockerBuild may be used to specify detailed instructions about how to build a container.

property args

args?: pulumi.Input<Record<string, pulumi.Input<string>>>;

An optional map of named build-time argument variables to set during the Docker build. This flag allows you to pass built-time variables that can be accessed like environment variables inside the RUN instruction.

property cacheFrom

cacheFrom?: pulumi.Input<boolean | CacheFrom>;

An optional CacheFrom object with information about the build stages to use for the Docker build cache. This parameter maps to the –cache-from argument to the Docker CLI. If this parameter is true, only the final image will be pulled and passed to –cache-from; if it is a CacheFrom object, the stages named therein will also be pulled and passed to –cache-from.

property context

context?: pulumi.Input<string>;

context is a path to a directory to use for the Docker build context, usually the directory in which the Dockerfile resides (although dockerfile may be used to choose a custom location independent of this choice). If not specified, the context defaults to the current working directory; if a relative path is used, it is relative to the current working directory that Pulumi is evaluating.

property dockerfile

dockerfile?: pulumi.Input<string>;

dockerfile may be used to override the default Dockerfile name and/or location. By default, it is assumed to be a file named Dockerfile in the root of the build context.

interface ImageArgs

Arguments for constructing an Image resource.

property build

build: pulumi.Input<string | docker.DockerBuild>;

The Docker build context, as a folder path or a detailed DockerBuild object.

property imageName

imageName: pulumi.Input<string>;

The qualified image name that will be pushed to the remote registry. Must be a supported image name for the target registry user. This name can include a tag at the end. If provided all pushed image resources will contain that tag as well.

Either [imageName] or [localImageName] can have a tag. However, if both have a tag, then those tags must match.

property localImageName

localImageName?: pulumi.Input<string>;

The docker image name to build locally before tagging with imageName. If not provided, it will be given the value of to [imageName]. This name can include a tag at the end. If provided all pushed image resources will contain that tag as well.

Either [imageName] or [localImageName] can have a tag. However, if both have a tag, then those tags must match.

property registry

registry?: pulumi.Input<ImageRegistry>;

Credentials for the docker registry to push to.

interface ImageRegistry

property password

password: pulumi.Input<string>;

Password for login to the target Docker registry.

property server

server: pulumi.Input<string>;

Docker registry server URL to push to. Some common values include: DockerHub: docker.io or https://index.docker.io/v1 Azure Container Registry: <name>.azurecr.io AWS Elastic Container Registry: <account>.dkr.ecr.us-east-2.amazonaws.com Google Container Registry: <name>.gcr.io

property username

username: pulumi.Input<string>;

Username for login to the target Docker registry.

interface NetworkArgs

The set of arguments for constructing a Network resource.

property attachable

attachable?: pulumi.Input<boolean>;

Enable manual container attachment to the network. Defaults to false.

property checkDuplicate

checkDuplicate?: pulumi.Input<boolean>;

Requests daemon to check for networks with same name.

property driver

driver?: pulumi.Input<string>;

Name of the network driver to use. Defaults to bridge driver.

property ingress

ingress?: pulumi.Input<boolean>;

Create swarm routing-mesh network. Defaults to false.

property internal

internal?: pulumi.Input<boolean>;

Restrict external access to the network. Defaults to false.

property ipamConfigs

ipamConfigs?: pulumi.Input<pulumi.Input<{
    auxAddress: pulumi.Input<{[key: string]: any}>;
    gateway: pulumi.Input<string>;
    ipRange: pulumi.Input<string>;
    subnet: pulumi.Input<string>;
}>[]>;

See IPAM config below for details.

property ipamDriver

ipamDriver?: pulumi.Input<string>;

Driver used by the custom IP scheme of the network.

property ipv6

ipv6?: pulumi.Input<boolean>;

Enable IPv6 networking. Defaults to false.

property labels

labels?: pulumi.Input<{[key: string]: any}>;

User-defined key/value metadata.

property name

name?: pulumi.Input<string>;

The name of the Docker network.

property options

options?: pulumi.Input<{[key: string]: any}>;

Network specific options to be used by the drivers.

interface NetworkState

Input properties used for looking up and filtering Network resources.

property attachable

attachable?: pulumi.Input<boolean>;

Enable manual container attachment to the network. Defaults to false.

property checkDuplicate

checkDuplicate?: pulumi.Input<boolean>;

Requests daemon to check for networks with same name.

property driver

driver?: pulumi.Input<string>;

Name of the network driver to use. Defaults to bridge driver.

property ingress

ingress?: pulumi.Input<boolean>;

Create swarm routing-mesh network. Defaults to false.

property internal

internal?: pulumi.Input<boolean>;

Restrict external access to the network. Defaults to false.

property ipamConfigs

ipamConfigs?: pulumi.Input<pulumi.Input<{
    auxAddress: pulumi.Input<{[key: string]: any}>;
    gateway: pulumi.Input<string>;
    ipRange: pulumi.Input<string>;
    subnet: pulumi.Input<string>;
}>[]>;

See IPAM config below for details.

property ipamDriver

ipamDriver?: pulumi.Input<string>;

Driver used by the custom IP scheme of the network.

property ipv6

ipv6?: pulumi.Input<boolean>;

Enable IPv6 networking. Defaults to false.

property labels

labels?: pulumi.Input<{[key: string]: any}>;

User-defined key/value metadata.

property name

name?: pulumi.Input<string>;

The name of the Docker network.

property options

options?: pulumi.Input<{[key: string]: any}>;

Network specific options to be used by the drivers.

property scope

scope?: pulumi.Input<string>;

interface ProviderArgs

The set of arguments for constructing a Provider resource.

property caMaterial

caMaterial?: pulumi.Input<string>;

PEM-encoded content of Docker host CA certificate

property certMaterial

certMaterial?: pulumi.Input<string>;

PEM-encoded content of Docker client certificate

property certPath

certPath?: pulumi.Input<string>;

Path to directory with Docker TLS config

property host

host?: pulumi.Input<string>;

The Docker daemon address

property keyMaterial

keyMaterial?: pulumi.Input<string>;

PEM-encoded content of Docker client private key

property registryAuth

registryAuth?: pulumi.Input<pulumi.Input<{
    address: pulumi.Input<string>;
    configFile: pulumi.Input<string>;
    password: pulumi.Input<string>;
    username: pulumi.Input<string>;
}>[]>;

interface Registry

interface RemoteImageArgs

The set of arguments for constructing a RemoteImage resource.

property keepLocally

keepLocally?: pulumi.Input<boolean>;

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

property name

name: pulumi.Input<string>;

The name of the Docker image, including any tags or SHA256 repo digests.

property pullTrigger

pullTrigger?: pulumi.Input<string>;

Deprecated, use pull_triggers instead.

property pullTriggers

pullTriggers?: pulumi.Input<pulumi.Input<string>[]>;

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker_registry_image data source to trigger an image update.

interface RemoteImageState

Input properties used for looking up and filtering RemoteImage resources.

property keepLocally

keepLocally?: pulumi.Input<boolean>;

If true, then the Docker image won’t be deleted on destroy operation. If this is false, it will delete the image from the docker local storage on destroy operation.

property latest

latest?: pulumi.Input<string>;

property name

name?: pulumi.Input<string>;

The name of the Docker image, including any tags or SHA256 repo digests.

property pullTrigger

pullTrigger?: pulumi.Input<string>;

Deprecated, use pull_triggers instead.

property pullTriggers

pullTriggers?: pulumi.Input<pulumi.Input<string>[]>;

List of values which cause an image pull when changed. This is used to store the image digest from the registry when using the docker_registry_image data source to trigger an image update.

interface VolumeArgs

The set of arguments for constructing a Volume resource.

property driver

driver?: pulumi.Input<string>;

Driver type for the volume (defaults to local).

property driverOpts

driverOpts?: pulumi.Input<{[key: string]: any}>;

Options specific to the driver.

property labels

labels?: pulumi.Input<{[key: string]: any}>;

User-defined key/value metadata.

property name

name?: pulumi.Input<string>;

The name of the Docker volume (generated if not provided).

interface VolumeState

Input properties used for looking up and filtering Volume resources.

property driver

driver?: pulumi.Input<string>;

Driver type for the volume (defaults to local).

property driverOpts

driverOpts?: pulumi.Input<{[key: string]: any}>;

Options specific to the driver.

property labels

labels?: pulumi.Input<{[key: string]: any}>;

User-defined key/value metadata.

property mountpoint

mountpoint?: pulumi.Input<string>;

property name

name?: pulumi.Input<string>;

The name of the Docker volume (generated if not provided).