Join us at the Cloud Engineering Summit on October 20th for a free day of learning. Save your spot.

Container

Import

Example Assuming you created a container as follows #!/bin/bash docker run –name foo -p8080:80 -d nginx

prints the container ID

9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd you provide the definition for the resource as follows terraform resource “docker_container” “foo” {

name

= “foo”

image = “nginx”

ports {

internal = “80”

external = “8080”

} } then the import command is as follows #!/bin/bash

 $ pulumi import docker:index/container:Container foo 9a550c0f0163d39d77222d3efd58701b625d47676c25c686c95b5b92d1cba6fd

Create a Container Resource

new Container(name: string, args: ContainerArgs, opts?: CustomResourceOptions);
@overload
def Container(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              attach: Optional[bool] = None,
              capabilities: Optional[ContainerCapabilitiesArgs] = None,
              command: Optional[Sequence[str]] = None,
              cpu_set: Optional[str] = None,
              cpu_shares: Optional[int] = None,
              destroy_grace_seconds: Optional[int] = None,
              devices: Optional[Sequence[ContainerDeviceArgs]] = None,
              dns: Optional[Sequence[str]] = None,
              dns_opts: Optional[Sequence[str]] = None,
              dns_searches: Optional[Sequence[str]] = None,
              domainname: Optional[str] = None,
              entrypoints: Optional[Sequence[str]] = None,
              envs: Optional[Sequence[str]] = None,
              group_adds: Optional[Sequence[str]] = None,
              healthcheck: Optional[ContainerHealthcheckArgs] = None,
              hostname: Optional[str] = None,
              hosts: Optional[Sequence[ContainerHostArgs]] = None,
              image: Optional[str] = None,
              init: Optional[bool] = None,
              ipc_mode: Optional[str] = None,
              labels: Optional[Sequence[ContainerLabelArgs]] = None,
              links: Optional[Sequence[str]] = None,
              log_driver: Optional[str] = None,
              log_opts: Optional[Mapping[str, Any]] = None,
              logs: Optional[bool] = None,
              max_retry_count: Optional[int] = None,
              memory: Optional[int] = None,
              memory_swap: Optional[int] = None,
              mounts: Optional[Sequence[ContainerMountArgs]] = None,
              must_run: Optional[bool] = None,
              name: Optional[str] = None,
              network_aliases: Optional[Sequence[str]] = None,
              network_mode: Optional[str] = None,
              networks: Optional[Sequence[str]] = None,
              networks_advanced: Optional[Sequence[ContainerNetworksAdvancedArgs]] = None,
              pid_mode: Optional[str] = None,
              ports: Optional[Sequence[ContainerPortArgs]] = None,
              privileged: Optional[bool] = None,
              publish_all_ports: Optional[bool] = None,
              read_only: Optional[bool] = None,
              remove_volumes: Optional[bool] = None,
              restart: Optional[str] = None,
              rm: Optional[bool] = None,
              security_opts: Optional[Sequence[str]] = None,
              shm_size: Optional[int] = None,
              start: Optional[bool] = None,
              stdin_open: Optional[bool] = None,
              storage_opts: Optional[Mapping[str, Any]] = None,
              sysctls: Optional[Mapping[str, Any]] = None,
              tmpfs: Optional[Mapping[str, Any]] = None,
              tty: Optional[bool] = None,
              ulimits: Optional[Sequence[ContainerUlimitArgs]] = None,
              uploads: Optional[Sequence[ContainerUploadArgs]] = None,
              user: Optional[str] = None,
              userns_mode: Optional[str] = None,
              volumes: Optional[Sequence[ContainerVolumeArgs]] = None,
              working_dir: Optional[str] = None)
@overload
def Container(resource_name: str,
              args: ContainerArgs,
              opts: Optional[ResourceOptions] = None)
func NewContainer(ctx *Context, name string, args ContainerArgs, opts ...ResourceOption) (*Container, error)
public Container(string name, ContainerArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ContainerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ContainerArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ContainerArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ContainerArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Container Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Container resource accepts the following input properties:

Image 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.
Attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
Capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
Command List<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","-","baz.con"].
CpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
CpuShares int
CPU shares (relative weight) for the container.
DestroyGraceSeconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
Devices List<ContainerDeviceArgs>
Bind devices to the container.
Dns List<string>
DNS servers to use.
DnsOpts List<string>
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
DnsSearches List<string>
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
Domainname string
Domain name of the container.
Entrypoints List<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/myprogra"].
Envs List<string>
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
GroupAdds List<string>
Additional groups for the container user
Healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
Hostname string
Hostname of the container.
Hosts List<ContainerHostArgs>
Additional hosts to add to the container.
Init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
IpcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
Labels List<ContainerLabelArgs>
User-defined key/value metadata
Links List<string>
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

LogDriver string
The logging driver to use for the container. Defaults to json-file.
LogOpts Dictionary<string, object>
Key/value pairs to use as options for the logging driver.
Logs bool
Save the container logs (attach must be enabled). Defaults to false.
MaxRetryCount int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
Memory int
The memory limit for the container in MBs.
MemorySwap int
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.
Mounts List<ContainerMountArgs>
Specification for mounts to be added to containers created as part of the service.
MustRun bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
Name string
The name of the container.
NetworkAliases List<string>
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworkMode string
Network mode of the container.
Networks List<string>
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworksAdvanced List<ContainerNetworksAdvancedArgs>
The networks the container is attached to
PidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
Ports List<ContainerPortArgs>
Publish a container’s port(s) to the host.
Privileged bool
If true, the container runs in privileged mode.
PublishAllPorts bool
Publish all ports of the container.
ReadOnly bool
If true, the container will be started as readonly. Defaults to false.
RemoveVolumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
Restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
Rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
SecurityOpts List<string>
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
ShmSize int
Size of /dev/shm in MBs.
Start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
StdinOpen bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
StorageOpts Dictionary<string, object>
Key/value pairs for the storage driver options, e.g. size: 120G
Sysctls Dictionary<string, object>
A map of kernel parameters (sysctls) to set in the container.
Tmpfs Dictionary<string, object>
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
Tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
Ulimits List<ContainerUlimitArgs>
Ulimit options to add.
Uploads List<ContainerUploadArgs>
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
User 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.
UsernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
Volumes List<ContainerVolumeArgs>
Spec for mounting volumes in the container.
WorkingDir string
The working directory for commands to run in.
Image 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.
Attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
Capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
Command []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","-","baz.con"].
CpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
CpuShares int
CPU shares (relative weight) for the container.
DestroyGraceSeconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
Devices []ContainerDeviceArgs
Bind devices to the container.
Dns []string
DNS servers to use.
DnsOpts []string
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
DnsSearches []string
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
Domainname string
Domain name of the container.
Entrypoints []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/myprogra"].
Envs []string
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
GroupAdds []string
Additional groups for the container user
Healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
Hostname string
Hostname of the container.
Hosts []ContainerHostArgs
Additional hosts to add to the container.
Init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
IpcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
Labels []ContainerLabelArgs
User-defined key/value metadata
Links []string
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

LogDriver string
The logging driver to use for the container. Defaults to json-file.
LogOpts map[string]interface{}
Key/value pairs to use as options for the logging driver.
Logs bool
Save the container logs (attach must be enabled). Defaults to false.
MaxRetryCount int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
Memory int
The memory limit for the container in MBs.
MemorySwap int
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.
Mounts []ContainerMountArgs
Specification for mounts to be added to containers created as part of the service.
MustRun bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
Name string
The name of the container.
NetworkAliases []string
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworkMode string
Network mode of the container.
Networks []string
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworksAdvanced []ContainerNetworksAdvancedArgs
The networks the container is attached to
PidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
Ports []ContainerPortArgs
Publish a container’s port(s) to the host.
Privileged bool
If true, the container runs in privileged mode.
PublishAllPorts bool
Publish all ports of the container.
ReadOnly bool
If true, the container will be started as readonly. Defaults to false.
RemoveVolumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
Restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
Rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
SecurityOpts []string
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
ShmSize int
Size of /dev/shm in MBs.
Start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
StdinOpen bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
StorageOpts map[string]interface{}
Key/value pairs for the storage driver options, e.g. size: 120G
Sysctls map[string]interface{}
A map of kernel parameters (sysctls) to set in the container.
Tmpfs map[string]interface{}
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
Tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
Ulimits []ContainerUlimitArgs
Ulimit options to add.
Uploads []ContainerUploadArgs
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
User 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.
UsernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
Volumes []ContainerVolumeArgs
Spec for mounting volumes in the container.
WorkingDir string
The working directory for commands to run in.
image 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.
attach boolean
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
command 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","-","baz.con"].
cpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
cpuShares number
CPU shares (relative weight) for the container.
destroyGraceSeconds number
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
devices ContainerDeviceArgs[]
Bind devices to the container.
dns string[]
DNS servers to use.
dnsOpts string[]
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
dnsSearches string[]
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
domainname string
Domain name of the container.
entrypoints 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/myprogra"].
envs string[]
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
groupAdds string[]
Additional groups for the container user
healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
hostname string
Hostname of the container.
hosts ContainerHostArgs[]
Additional hosts to add to the container.
init boolean
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
ipcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
labels ContainerLabelArgs[]
User-defined key/value metadata
links string[]
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

logDriver string
The logging driver to use for the container. Defaults to json-file.
logOpts {[key: string]: any}
Key/value pairs to use as options for the logging driver.
logs boolean
Save the container logs (attach must be enabled). Defaults to false.
maxRetryCount number
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
memory number
The memory limit for the container in MBs.
memorySwap 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.
mounts ContainerMountArgs[]
Specification for mounts to be added to containers created as part of the service.
mustRun 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. Defaults to true.
name string
The name of the container.
networkAliases string[]
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networkMode string
Network mode of the container.
networks string[]
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networksAdvanced ContainerNetworksAdvancedArgs[]
The networks the container is attached to
pidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
ports ContainerPortArgs[]
Publish a container’s port(s) to the host.
privileged boolean
If true, the container runs in privileged mode.
publishAllPorts boolean
Publish all ports of the container.
readOnly boolean
If true, the container will be started as readonly. Defaults to false.
removeVolumes boolean
If true, it will remove anonymous volumes associated with the container. Defaults to true.
restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
rm boolean
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
securityOpts string[]
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
shmSize number
Size of /dev/shm in MBs.
start boolean
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
stdinOpen boolean
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
storageOpts {[key: string]: any}
Key/value pairs for the storage driver options, e.g. size: 120G
sysctls {[key: string]: any}
A map of kernel parameters (sysctls) to set in the container.
tmpfs {[key: string]: any}
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
tty boolean
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
ulimits ContainerUlimitArgs[]
Ulimit options to add.
uploads ContainerUploadArgs[]
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
user 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.
usernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
volumes ContainerVolumeArgs[]
Spec for mounting volumes in the container.
workingDir string
The working directory for commands to run in.
image str
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.
attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
command Sequence[str]
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","-","baz.con"].
cpu_set str
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
cpu_shares int
CPU shares (relative weight) for the container.
destroy_grace_seconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
devices Sequence[ContainerDeviceArgs]
Bind devices to the container.
dns Sequence[str]
DNS servers to use.
dns_opts Sequence[str]
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
dns_searches Sequence[str]
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
domainname str
Domain name of the container.
entrypoints Sequence[str]
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/myprogra"].
envs Sequence[str]
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
group_adds Sequence[str]
Additional groups for the container user
healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
hostname str
Hostname of the container.
hosts Sequence[ContainerHostArgs]
Additional hosts to add to the container.
init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
ipc_mode str
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
labels Sequence[ContainerLabelArgs]
User-defined key/value metadata
links Sequence[str]
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

log_driver str
The logging driver to use for the container. Defaults to json-file.
log_opts Mapping[str, Any]
Key/value pairs to use as options for the logging driver.
logs bool
Save the container logs (attach must be enabled). Defaults to false.
max_retry_count int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
memory int
The memory limit for the container in MBs.
memory_swap int
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.
mounts Sequence[ContainerMountArgs]
Specification for mounts to be added to containers created as part of the service.
must_run bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
name str
The name of the container.
network_aliases Sequence[str]
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

network_mode str
Network mode of the container.
networks Sequence[str]
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networks_advanced Sequence[ContainerNetworksAdvancedArgs]
The networks the container is attached to
pid_mode str
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
ports Sequence[ContainerPortArgs]
Publish a container’s port(s) to the host.
privileged bool
If true, the container runs in privileged mode.
publish_all_ports bool
Publish all ports of the container.
read_only bool
If true, the container will be started as readonly. Defaults to false.
remove_volumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
restart str
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
security_opts Sequence[str]
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
shm_size int
Size of /dev/shm in MBs.
start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
stdin_open bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
storage_opts Mapping[str, Any]
Key/value pairs for the storage driver options, e.g. size: 120G
sysctls Mapping[str, Any]
A map of kernel parameters (sysctls) to set in the container.
tmpfs Mapping[str, Any]
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
ulimits Sequence[ContainerUlimitArgs]
Ulimit options to add.
uploads Sequence[ContainerUploadArgs]
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
user str
User used for run the first process. Format is user or user:group which user and group can be passed literraly or by name.
userns_mode str
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
volumes Sequence[ContainerVolumeArgs]
Spec for mounting volumes in the container.
working_dir str
The working directory for commands to run in.

Outputs

All input properties are implicitly available as output properties. Additionally, the Container resource produces the following output properties:

Bridge string
The network bridge of the container as read from its NetworkSettings.
ContainerLogs string
The logs of the container if its execution is done (attach must be disabled).
ExitCode int
The exit code of the container if its execution is done (must_run must be disabled).
Gateway string
The network gateway of the container.

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

Id string
The provider-assigned unique ID for this managed resource.
IpAddress string
The IP address of the container.

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

IpPrefixLength int
The IP prefix length of the container.

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

NetworkDatas List<ContainerNetworkData>
The data of the networks the container is connected to.
Bridge string
The network bridge of the container as read from its NetworkSettings.
ContainerLogs string
The logs of the container if its execution is done (attach must be disabled).
ExitCode int
The exit code of the container if its execution is done (must_run must be disabled).
Gateway string
The network gateway of the container.

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

Id string
The provider-assigned unique ID for this managed resource.
IpAddress string
The IP address of the container.

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

IpPrefixLength int
The IP prefix length of the container.

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

NetworkDatas []ContainerNetworkData
The data of the networks the container is connected to.
bridge string
The network bridge of the container as read from its NetworkSettings.
containerLogs string
The logs of the container if its execution is done (attach must be disabled).
exitCode number
The exit code of the container if its execution is done (must_run must be disabled).
gateway string
The network gateway of the container.

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

id string
The provider-assigned unique ID for this managed resource.
ipAddress string
The IP address of the container.

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

ipPrefixLength number
The IP prefix length of the container.

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

networkDatas ContainerNetworkData[]
The data of the networks the container is connected to.
bridge str
The network bridge of the container as read from its NetworkSettings.
container_logs str
The logs of the container if its execution is done (attach must be disabled).
exit_code int
The exit code of the container if its execution is done (must_run must be disabled).
gateway str
The network gateway of the container.

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

id str
The provider-assigned unique ID for this managed resource.
ip_address str
The IP address of the container.

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

ip_prefix_length int
The IP prefix length of the container.

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

network_datas Sequence[ContainerNetworkData]
The data of the networks the container is connected to.

Look up an Existing Container Resource

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

public static get(name: string, id: Input<ID>, state?: ContainerState, opts?: CustomResourceOptions): Container
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        attach: Optional[bool] = None,
        bridge: Optional[str] = None,
        capabilities: Optional[ContainerCapabilitiesArgs] = None,
        command: Optional[Sequence[str]] = None,
        container_logs: Optional[str] = None,
        cpu_set: Optional[str] = None,
        cpu_shares: Optional[int] = None,
        destroy_grace_seconds: Optional[int] = None,
        devices: Optional[Sequence[ContainerDeviceArgs]] = None,
        dns: Optional[Sequence[str]] = None,
        dns_opts: Optional[Sequence[str]] = None,
        dns_searches: Optional[Sequence[str]] = None,
        domainname: Optional[str] = None,
        entrypoints: Optional[Sequence[str]] = None,
        envs: Optional[Sequence[str]] = None,
        exit_code: Optional[int] = None,
        gateway: Optional[str] = None,
        group_adds: Optional[Sequence[str]] = None,
        healthcheck: Optional[ContainerHealthcheckArgs] = None,
        hostname: Optional[str] = None,
        hosts: Optional[Sequence[ContainerHostArgs]] = None,
        image: Optional[str] = None,
        init: Optional[bool] = None,
        ip_address: Optional[str] = None,
        ip_prefix_length: Optional[int] = None,
        ipc_mode: Optional[str] = None,
        labels: Optional[Sequence[ContainerLabelArgs]] = None,
        links: Optional[Sequence[str]] = None,
        log_driver: Optional[str] = None,
        log_opts: Optional[Mapping[str, Any]] = None,
        logs: Optional[bool] = None,
        max_retry_count: Optional[int] = None,
        memory: Optional[int] = None,
        memory_swap: Optional[int] = None,
        mounts: Optional[Sequence[ContainerMountArgs]] = None,
        must_run: Optional[bool] = None,
        name: Optional[str] = None,
        network_aliases: Optional[Sequence[str]] = None,
        network_datas: Optional[Sequence[ContainerNetworkDataArgs]] = None,
        network_mode: Optional[str] = None,
        networks: Optional[Sequence[str]] = None,
        networks_advanced: Optional[Sequence[ContainerNetworksAdvancedArgs]] = None,
        pid_mode: Optional[str] = None,
        ports: Optional[Sequence[ContainerPortArgs]] = None,
        privileged: Optional[bool] = None,
        publish_all_ports: Optional[bool] = None,
        read_only: Optional[bool] = None,
        remove_volumes: Optional[bool] = None,
        restart: Optional[str] = None,
        rm: Optional[bool] = None,
        security_opts: Optional[Sequence[str]] = None,
        shm_size: Optional[int] = None,
        start: Optional[bool] = None,
        stdin_open: Optional[bool] = None,
        storage_opts: Optional[Mapping[str, Any]] = None,
        sysctls: Optional[Mapping[str, Any]] = None,
        tmpfs: Optional[Mapping[str, Any]] = None,
        tty: Optional[bool] = None,
        ulimits: Optional[Sequence[ContainerUlimitArgs]] = None,
        uploads: Optional[Sequence[ContainerUploadArgs]] = None,
        user: Optional[str] = None,
        userns_mode: Optional[str] = None,
        volumes: Optional[Sequence[ContainerVolumeArgs]] = None,
        working_dir: Optional[str] = None) -> Container
func GetContainer(ctx *Context, name string, id IDInput, state *ContainerState, opts ...ResourceOption) (*Container, error)
public static Container Get(string name, Input<string> id, ContainerState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
Bridge string
The network bridge of the container as read from its NetworkSettings.
Capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
Command List<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","-","baz.con"].
ContainerLogs string
The logs of the container if its execution is done (attach must be disabled).
CpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
CpuShares int
CPU shares (relative weight) for the container.
DestroyGraceSeconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
Devices List<ContainerDeviceArgs>
Bind devices to the container.
Dns List<string>
DNS servers to use.
DnsOpts List<string>
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
DnsSearches List<string>
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
Domainname string
Domain name of the container.
Entrypoints List<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/myprogra"].
Envs List<string>
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
ExitCode int
The exit code of the container if its execution is done (must_run must be disabled).
Gateway string
The network gateway of the container.

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

GroupAdds List<string>
Additional groups for the container user
Healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
Hostname string
Hostname of the container.
Hosts List<ContainerHostArgs>
Additional hosts to add to the container.
Image 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.
Init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
IpAddress string
The IP address of the container.

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

IpPrefixLength int
The IP prefix length of the container.

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

IpcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
Labels List<ContainerLabelArgs>
User-defined key/value metadata
Links List<string>
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

LogDriver string
The logging driver to use for the container. Defaults to json-file.
LogOpts Dictionary<string, object>
Key/value pairs to use as options for the logging driver.
Logs bool
Save the container logs (attach must be enabled). Defaults to false.
MaxRetryCount int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
Memory int
The memory limit for the container in MBs.
MemorySwap int
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.
Mounts List<ContainerMountArgs>
Specification for mounts to be added to containers created as part of the service.
MustRun bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
Name string
The name of the container.
NetworkAliases List<string>
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworkDatas List<ContainerNetworkDataArgs>
The data of the networks the container is connected to.
NetworkMode string
Network mode of the container.
Networks List<string>
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworksAdvanced List<ContainerNetworksAdvancedArgs>
The networks the container is attached to
PidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
Ports List<ContainerPortArgs>
Publish a container’s port(s) to the host.
Privileged bool
If true, the container runs in privileged mode.
PublishAllPorts bool
Publish all ports of the container.
ReadOnly bool
If true, the container will be started as readonly. Defaults to false.
RemoveVolumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
Restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
Rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
SecurityOpts List<string>
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
ShmSize int
Size of /dev/shm in MBs.
Start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
StdinOpen bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
StorageOpts Dictionary<string, object>
Key/value pairs for the storage driver options, e.g. size: 120G
Sysctls Dictionary<string, object>
A map of kernel parameters (sysctls) to set in the container.
Tmpfs Dictionary<string, object>
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
Tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
Ulimits List<ContainerUlimitArgs>
Ulimit options to add.
Uploads List<ContainerUploadArgs>
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
User 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.
UsernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
Volumes List<ContainerVolumeArgs>
Spec for mounting volumes in the container.
WorkingDir string
The working directory for commands to run in.
Attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
Bridge string
The network bridge of the container as read from its NetworkSettings.
Capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
Command []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","-","baz.con"].
ContainerLogs string
The logs of the container if its execution is done (attach must be disabled).
CpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
CpuShares int
CPU shares (relative weight) for the container.
DestroyGraceSeconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
Devices []ContainerDeviceArgs
Bind devices to the container.
Dns []string
DNS servers to use.
DnsOpts []string
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
DnsSearches []string
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
Domainname string
Domain name of the container.
Entrypoints []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/myprogra"].
Envs []string
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
ExitCode int
The exit code of the container if its execution is done (must_run must be disabled).
Gateway string
The network gateway of the container.

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

GroupAdds []string
Additional groups for the container user
Healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
Hostname string
Hostname of the container.
Hosts []ContainerHostArgs
Additional hosts to add to the container.
Image 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.
Init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
IpAddress string
The IP address of the container.

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

IpPrefixLength int
The IP prefix length of the container.

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

IpcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
Labels []ContainerLabelArgs
User-defined key/value metadata
Links []string
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

LogDriver string
The logging driver to use for the container. Defaults to json-file.
LogOpts map[string]interface{}
Key/value pairs to use as options for the logging driver.
Logs bool
Save the container logs (attach must be enabled). Defaults to false.
MaxRetryCount int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
Memory int
The memory limit for the container in MBs.
MemorySwap int
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.
Mounts []ContainerMountArgs
Specification for mounts to be added to containers created as part of the service.
MustRun bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
Name string
The name of the container.
NetworkAliases []string
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworkDatas []ContainerNetworkDataArgs
The data of the networks the container is connected to.
NetworkMode string
Network mode of the container.
Networks []string
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

NetworksAdvanced []ContainerNetworksAdvancedArgs
The networks the container is attached to
PidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
Ports []ContainerPortArgs
Publish a container’s port(s) to the host.
Privileged bool
If true, the container runs in privileged mode.
PublishAllPorts bool
Publish all ports of the container.
ReadOnly bool
If true, the container will be started as readonly. Defaults to false.
RemoveVolumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
Restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
Rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
SecurityOpts []string
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
ShmSize int
Size of /dev/shm in MBs.
Start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
StdinOpen bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
StorageOpts map[string]interface{}
Key/value pairs for the storage driver options, e.g. size: 120G
Sysctls map[string]interface{}
A map of kernel parameters (sysctls) to set in the container.
Tmpfs map[string]interface{}
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
Tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
Ulimits []ContainerUlimitArgs
Ulimit options to add.
Uploads []ContainerUploadArgs
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
User 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.
UsernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
Volumes []ContainerVolumeArgs
Spec for mounting volumes in the container.
WorkingDir string
The working directory for commands to run in.
attach boolean
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
bridge string
The network bridge of the container as read from its NetworkSettings.
capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
command 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","-","baz.con"].
containerLogs string
The logs of the container if its execution is done (attach must be disabled).
cpuSet string
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
cpuShares number
CPU shares (relative weight) for the container.
destroyGraceSeconds number
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
devices ContainerDeviceArgs[]
Bind devices to the container.
dns string[]
DNS servers to use.
dnsOpts string[]
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
dnsSearches string[]
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
domainname string
Domain name of the container.
entrypoints 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/myprogra"].
envs string[]
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
exitCode number
The exit code of the container if its execution is done (must_run must be disabled).
gateway string
The network gateway of the container.

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

groupAdds string[]
Additional groups for the container user
healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
hostname string
Hostname of the container.
hosts ContainerHostArgs[]
Additional hosts to add to the container.
image 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.
init boolean
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
ipAddress string
The IP address of the container.

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

ipPrefixLength number
The IP prefix length of the container.

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

ipcMode string
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
labels ContainerLabelArgs[]
User-defined key/value metadata
links string[]
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

logDriver string
The logging driver to use for the container. Defaults to json-file.
logOpts {[key: string]: any}
Key/value pairs to use as options for the logging driver.
logs boolean
Save the container logs (attach must be enabled). Defaults to false.
maxRetryCount number
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
memory number
The memory limit for the container in MBs.
memorySwap 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.
mounts ContainerMountArgs[]
Specification for mounts to be added to containers created as part of the service.
mustRun 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. Defaults to true.
name string
The name of the container.
networkAliases string[]
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networkDatas ContainerNetworkDataArgs[]
The data of the networks the container is connected to.
networkMode string
Network mode of the container.
networks string[]
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networksAdvanced ContainerNetworksAdvancedArgs[]
The networks the container is attached to
pidMode string
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
ports ContainerPortArgs[]
Publish a container’s port(s) to the host.
privileged boolean
If true, the container runs in privileged mode.
publishAllPorts boolean
Publish all ports of the container.
readOnly boolean
If true, the container will be started as readonly. Defaults to false.
removeVolumes boolean
If true, it will remove anonymous volumes associated with the container. Defaults to true.
restart string
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
rm boolean
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
securityOpts string[]
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
shmSize number
Size of /dev/shm in MBs.
start boolean
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
stdinOpen boolean
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
storageOpts {[key: string]: any}
Key/value pairs for the storage driver options, e.g. size: 120G
sysctls {[key: string]: any}
A map of kernel parameters (sysctls) to set in the container.
tmpfs {[key: string]: any}
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
tty boolean
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
ulimits ContainerUlimitArgs[]
Ulimit options to add.
uploads ContainerUploadArgs[]
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
user 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.
usernsMode string
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
volumes ContainerVolumeArgs[]
Spec for mounting volumes in the container.
workingDir string
The working directory for commands to run in.
attach bool
If true attach to the container after its creation and waits the end of its execution. Defaults to false.
bridge str
The network bridge of the container as read from its NetworkSettings.
capabilities ContainerCapabilitiesArgs
Add or drop certrain linux capabilities.
command Sequence[str]
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","-","baz.con"].
container_logs str
The logs of the container if its execution is done (attach must be disabled).
cpu_set str
A comma-separated list or hyphen-separated range of CPUs a container can use, e.g. 0-1.
cpu_shares int
CPU shares (relative weight) for the container.
destroy_grace_seconds int
If defined will attempt to stop the container before destroying. Container will be destroyed after n seconds or on successful stop.
devices Sequence[ContainerDeviceArgs]
Bind devices to the container.
dns Sequence[str]
DNS servers to use.
dns_opts Sequence[str]
DNS options used by the DNS provider(s), see resolv.conf documentation for valid list of options.
dns_searches Sequence[str]
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
domainname str
Domain name of the container.
entrypoints Sequence[str]
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/myprogra"].
envs Sequence[str]
Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0
exit_code int
The exit code of the container if its execution is done (must_run must be disabled).
gateway str
The network gateway of the container.

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

group_adds Sequence[str]
Additional groups for the container user
healthcheck ContainerHealthcheckArgs
A test to perform to check that the container is healthy
hostname str
Hostname of the container.
hosts Sequence[ContainerHostArgs]
Additional hosts to add to the container.
image str
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.
init bool
Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.
ip_address str
The IP address of the container.

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

ip_prefix_length int
The IP prefix length of the container.

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

ipc_mode str
IPC sharing mode for the container. Possible values are: none, private, shareable, container:<name|id> or host.
labels Sequence[ContainerLabelArgs]
User-defined key/value metadata
links Sequence[str]
Set of links for link based connectivity between containers that are running on the same host.

Deprecated: The –link flag is a legacy feature of Docker. It may eventually be removed.

log_driver str
The logging driver to use for the container. Defaults to json-file.
log_opts Mapping[str, Any]
Key/value pairs to use as options for the logging driver.
logs bool
Save the container logs (attach must be enabled). Defaults to false.
max_retry_count int
The maximum amount of times to an attempt a restart when restart is set to ‘on-failure’.
memory int
The memory limit for the container in MBs.
memory_swap int
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.
mounts Sequence[ContainerMountArgs]
Specification for mounts to be added to containers created as part of the service.
must_run bool
If true, then the Docker container will be kept running. If false, then as long as the container exists, Terraform assumes it is successful. Defaults to true.
name str
The name of the container.
network_aliases Sequence[str]
Set an alias for the container in all specified networks

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

network_datas Sequence[ContainerNetworkDataArgs]
The data of the networks the container is connected to.
network_mode str
Network mode of the container.
networks Sequence[str]
ID of the networks in which the container is.

Deprecated: Use networks_advanced instead. Will be removed in v3.0.0

networks_advanced Sequence[ContainerNetworksAdvancedArgs]
The networks the container is attached to
pid_mode str
he PID (Process) Namespace mode for the container. Either container:<name|id> or host.
ports Sequence[ContainerPortArgs]
Publish a container’s port(s) to the host.
privileged bool
If true, the container runs in privileged mode.
publish_all_ports bool
Publish all ports of the container.
read_only bool
If true, the container will be started as readonly. Defaults to false.
remove_volumes bool
If true, it will remove anonymous volumes associated with the container. Defaults to true.
restart str
The restart policy for the container. Must be one of ‘no’, ‘on-failure’, ‘always’, ‘unless-stopped’. Defaults to no.
rm bool
If true, then the container will be automatically removed after his execution. Terraform won’t check this container after creation. Defaults to false.
security_opts Sequence[str]
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
shm_size int
Size of /dev/shm in MBs.
start bool
If true, then the Docker container will be started after creation. If false, then the container is only created. Defaults to true.
stdin_open bool
If true, keep STDIN open even if not attached (docker run -i). Defaults to false.
storage_opts Mapping[str, Any]
Key/value pairs for the storage driver options, e.g. size: 120G
sysctls Mapping[str, Any]
A map of kernel parameters (sysctls) to set in the container.
tmpfs Mapping[str, Any]
A map of container directories which should be replaced by tmpfs mounts, and their corresponding mount options.
tty bool
If true, allocate a pseudo-tty (docker run -t). Defaults to false.
ulimits Sequence[ContainerUlimitArgs]
Ulimit options to add.
uploads Sequence[ContainerUploadArgs]
Specifies files to upload to the container before starting it. Only one of content or content_base64 can be set and at least one of them has to be set.
user str
User used for run the first process. Format is user or user:group which user and group can be passed literraly or by name.
userns_mode str
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
volumes Sequence[ContainerVolumeArgs]
Spec for mounting volumes in the container.
working_dir str
The working directory for commands to run in.

Supporting Types

ContainerCapabilities

Adds List<string>
Drops List<string>
Adds []string
Drops []string
adds string[]
drops string[]
adds Sequence[str]
drops Sequence[str]

ContainerDevice

HostPath string
ContainerPath string
Permissions string
HostPath string
ContainerPath string
Permissions string
hostPath string
containerPath string
permissions string
host_path str
container_path str
permissions str

ContainerHealthcheck

Tests List<string>
Interval string
Retries int
StartPeriod string
Timeout string
Tests []string
Interval string
Retries int
StartPeriod string
Timeout string
tests string[]
interval string
retries number
startPeriod string
timeout string
tests Sequence[str]
interval str
retries int
start_period str
timeout str

ContainerHost

Host string
Ip string
Host string
Ip string
host string
ip string
host str
ip str

ContainerLabel

Label string
Value string
Label string
Value string
label string
value string
label str
value str

ContainerMount

Target string
Type string
BindOptions ContainerMountBindOptions
ReadOnly bool
Source string
TmpfsOptions ContainerMountTmpfsOptions
VolumeOptions ContainerMountVolumeOptions
Target string
Type string
BindOptions ContainerMountBindOptions
ReadOnly bool
Source string
TmpfsOptions ContainerMountTmpfsOptions
VolumeOptions ContainerMountVolumeOptions
target string
type string
bindOptions ContainerMountBindOptions
readOnly boolean
source string
tmpfsOptions ContainerMountTmpfsOptions
volumeOptions ContainerMountVolumeOptions
target str
type str
bind_options ContainerMountBindOptions
read_only bool
source str
tmpfs_options ContainerMountTmpfsOptions
volume_options ContainerMountVolumeOptions

ContainerMountBindOptions

Propagation string
Propagation string
propagation string
propagation str

ContainerMountTmpfsOptions

Mode int
SizeBytes int
Mode int
SizeBytes int
mode number
sizeBytes number
mode int
size_bytes int

ContainerMountVolumeOptions

DriverName string
DriverOptions Dictionary<string, string>
Labels List<ContainerMountVolumeOptionsLabel>
NoCopy bool
DriverName string
DriverOptions map[string]string
Labels []ContainerMountVolumeOptionsLabel
NoCopy bool
driverName string
driverOptions {[key: string]: string}
labels ContainerMountVolumeOptionsLabel[]
noCopy boolean
driver_name str
driver_options Mapping[str, str]
labels Sequence[ContainerMountVolumeOptionsLabel]
no_copy bool

ContainerMountVolumeOptionsLabel

Label string
Value string
Label string
Value string
label string
value string
label str
value str

ContainerNetworkData

Gateway string

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

GlobalIpv6Address string
GlobalIpv6PrefixLength int
IpAddress string

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

IpPrefixLength int

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

Ipv6Gateway string
NetworkName string
Gateway string

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

GlobalIpv6Address string
GlobalIpv6PrefixLength int
IpAddress string

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

IpPrefixLength int

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

Ipv6Gateway string
NetworkName string
gateway string

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

globalIpv6Address string
globalIpv6PrefixLength number
ipAddress string

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

ipPrefixLength number

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

ipv6Gateway string
networkName string
gateway str

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

global_ipv6_address str
global_ipv6_prefix_length int
ip_address str

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

ip_prefix_length int

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

ipv6_gateway str
network_name str

ContainerNetworksAdvanced

Name string
Aliases List<string>
Ipv4Address string
Ipv6Address string
Name string
Aliases []string
Ipv4Address string
Ipv6Address string
name string
aliases string[]
ipv4Address string
ipv6Address string
name str
aliases Sequence[str]
ipv4_address str
ipv6_address str

ContainerPort

Internal int
External int
Ip string
Protocol string
Internal int
External int
Ip string
Protocol string
internal number
external number
ip string
protocol string
internal int
external int
ip str
protocol str

ContainerUlimit

Hard int
Name string
Soft int
Hard int
Name string
Soft int
hard number
name string
soft number
hard int
name str
soft int

ContainerUpload

File string
Content string
ContentBase64 string
Executable bool
Source string
SourceHash string
File string
Content string
ContentBase64 string
Executable bool
Source string
SourceHash string
file string
content string
contentBase64 string
executable boolean
source string
sourceHash string
file str
content str
content_base64 str
executable bool
source str
source_hash str

ContainerVolume

ContainerPath string
FromContainer string
HostPath string
ReadOnly bool
VolumeName string
ContainerPath string
FromContainer string
HostPath string
ReadOnly bool
VolumeName string
containerPath string
fromContainer string
hostPath string
readOnly boolean
volumeName string
container_path str
from_container str
host_path str
read_only bool
volume_name str

Package Details

Repository
https://github.com/pulumi/pulumi-docker
License
Apache-2.0
Notes
This Pulumi package is based on the docker Terraform Provider.