ContainerArgs

data class ContainerArgs(val attach: Output<Boolean>? = null, val capabilities: Output<ContainerCapabilitiesArgs>? = null, val command: Output<List<String>>? = null, val containerReadRefreshTimeoutMilliseconds: Output<Int>? = null, val cpuSet: Output<String>? = null, val cpuShares: Output<Int>? = null, val destroyGraceSeconds: Output<Int>? = null, val devices: Output<List<ContainerDeviceArgs>>? = null, val dns: Output<List<String>>? = null, val dnsOpts: Output<List<String>>? = null, val dnsSearches: Output<List<String>>? = null, val domainname: Output<String>? = null, val entrypoints: Output<List<String>>? = null, val envs: Output<List<String>>? = null, val gpus: Output<String>? = null, val groupAdds: Output<List<String>>? = null, val healthcheck: Output<ContainerHealthcheckArgs>? = null, val hostname: Output<String>? = null, val hosts: Output<List<ContainerHostArgs>>? = null, val image: Output<String>? = null, val init: Output<Boolean>? = null, val ipcMode: Output<String>? = null, val labels: Output<List<ContainerLabelArgs>>? = null, val links: Output<List<String>>? = null, val logDriver: Output<String>? = null, val logOpts: Output<Map<String, Any>>? = null, val logs: Output<Boolean>? = null, val maxRetryCount: Output<Int>? = null, val memory: Output<Int>? = null, val memorySwap: Output<Int>? = null, val mounts: Output<List<ContainerMountArgs>>? = null, val mustRun: Output<Boolean>? = null, val name: Output<String>? = null, val networkAliases: Output<List<String>>? = null, val networkMode: Output<String>? = null, val networks: Output<List<String>>? = null, val networksAdvanced: Output<List<ContainerNetworksAdvancedArgs>>? = null, val pidMode: Output<String>? = null, val ports: Output<List<ContainerPortArgs>>? = null, val privileged: Output<Boolean>? = null, val publishAllPorts: Output<Boolean>? = null, val readOnly: Output<Boolean>? = null, val removeVolumes: Output<Boolean>? = null, val restart: Output<String>? = null, val rm: Output<Boolean>? = null, val runtime: Output<String>? = null, val securityOpts: Output<List<String>>? = null, val shmSize: Output<Int>? = null, val start: Output<Boolean>? = null, val stdinOpen: Output<Boolean>? = null, val stopSignal: Output<String>? = null, val stopTimeout: Output<Int>? = null, val storageOpts: Output<Map<String, Any>>? = null, val sysctls: Output<Map<String, Any>>? = null, val tmpfs: Output<Map<String, Any>>? = null, val tty: Output<Boolean>? = null, val ulimits: Output<List<ContainerUlimitArgs>>? = null, val uploads: Output<List<ContainerUploadArgs>>? = null, val user: Output<String>? = null, val usernsMode: Output<String>? = null, val volumes: Output<List<ContainerVolumeArgs>>? = null, val wait: Output<Boolean>? = null, val waitTimeout: Output<Int>? = null, val workingDir: Output<String>? = null) : ConvertibleToJava<ContainerArgs>

Manages the lifecycle of a Docker container.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.RemoteImage;
import com.pulumi.docker.RemoteImageArgs;
import com.pulumi.docker.Container;
import com.pulumi.docker.ContainerArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var ubuntuRemoteImage = new RemoteImage("ubuntuRemoteImage", RemoteImageArgs.builder()
.name("ubuntu:precise")
.build());
var ubuntuContainer = new Container("ubuntuContainer", ContainerArgs.builder()
.image(ubuntuRemoteImage.imageId())
.build());
}
}

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

Constructors

Link copied to clipboard
constructor(attach: Output<Boolean>? = null, capabilities: Output<ContainerCapabilitiesArgs>? = null, command: Output<List<String>>? = null, containerReadRefreshTimeoutMilliseconds: Output<Int>? = null, cpuSet: Output<String>? = null, cpuShares: Output<Int>? = null, destroyGraceSeconds: Output<Int>? = null, devices: Output<List<ContainerDeviceArgs>>? = null, dns: Output<List<String>>? = null, dnsOpts: Output<List<String>>? = null, dnsSearches: Output<List<String>>? = null, domainname: Output<String>? = null, entrypoints: Output<List<String>>? = null, envs: Output<List<String>>? = null, gpus: Output<String>? = null, groupAdds: Output<List<String>>? = null, healthcheck: Output<ContainerHealthcheckArgs>? = null, hostname: Output<String>? = null, hosts: Output<List<ContainerHostArgs>>? = null, image: Output<String>? = null, init: Output<Boolean>? = null, ipcMode: Output<String>? = null, labels: Output<List<ContainerLabelArgs>>? = null, links: Output<List<String>>? = null, logDriver: Output<String>? = null, logOpts: Output<Map<String, Any>>? = null, logs: Output<Boolean>? = null, maxRetryCount: Output<Int>? = null, memory: Output<Int>? = null, memorySwap: Output<Int>? = null, mounts: Output<List<ContainerMountArgs>>? = null, mustRun: Output<Boolean>? = null, name: Output<String>? = null, networkAliases: Output<List<String>>? = null, networkMode: Output<String>? = null, networks: Output<List<String>>? = null, networksAdvanced: Output<List<ContainerNetworksAdvancedArgs>>? = null, pidMode: Output<String>? = null, ports: Output<List<ContainerPortArgs>>? = null, privileged: Output<Boolean>? = null, publishAllPorts: Output<Boolean>? = null, readOnly: Output<Boolean>? = null, removeVolumes: Output<Boolean>? = null, restart: Output<String>? = null, rm: Output<Boolean>? = null, runtime: Output<String>? = null, securityOpts: Output<List<String>>? = null, shmSize: Output<Int>? = null, start: Output<Boolean>? = null, stdinOpen: Output<Boolean>? = null, stopSignal: Output<String>? = null, stopTimeout: Output<Int>? = null, storageOpts: Output<Map<String, Any>>? = null, sysctls: Output<Map<String, Any>>? = null, tmpfs: Output<Map<String, Any>>? = null, tty: Output<Boolean>? = null, ulimits: Output<List<ContainerUlimitArgs>>? = null, uploads: Output<List<ContainerUploadArgs>>? = null, user: Output<String>? = null, usernsMode: Output<String>? = null, volumes: Output<List<ContainerVolumeArgs>>? = null, wait: Output<Boolean>? = null, waitTimeout: Output<Int>? = null, workingDir: Output<String>? = null)

Properties

Link copied to clipboard
val attach: Output<Boolean>? = null

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

Link copied to clipboard

Add or drop certrain linux capabilities.

Link copied to clipboard
val command: Output<List<String>>? = null

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&#46;con"].

Link copied to clipboard

The total number of milliseconds to wait for the container to reach status 'running'

Link copied to clipboard
val cpuSet: Output<String>? = null

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

Link copied to clipboard
val cpuShares: Output<Int>? = null

CPU shares (relative weight) for the container.

Link copied to clipboard
val destroyGraceSeconds: Output<Int>? = null

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

Link copied to clipboard
val devices: Output<List<ContainerDeviceArgs>>? = null

Bind devices to the container.

Link copied to clipboard
val dns: Output<List<String>>? = null

DNS servers to use.

Link copied to clipboard
val dnsOpts: Output<List<String>>? = null

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

Link copied to clipboard
val dnsSearches: Output<List<String>>? = null

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

Link copied to clipboard
val domainname: Output<String>? = null

Domain name of the container.

Link copied to clipboard
val entrypoints: Output<List<String>>? = null

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"].

Link copied to clipboard
val envs: Output<List<String>>? = null

Environment variables to set in the form of KEY=VALUE, e.g. DEBUG=0

Link copied to clipboard
val gpus: Output<String>? = null

GPU devices to add to the container. Currently, only the value all is supported. Passing any other value will result in unexpected behavior.

Link copied to clipboard
val groupAdds: Output<List<String>>? = null

Additional groups for the container user

Link copied to clipboard

A test to perform to check that the container is healthy

Link copied to clipboard
val hostname: Output<String>? = null

Hostname of the container.

Link copied to clipboard
val hosts: Output<List<ContainerHostArgs>>? = null

Additional hosts to add to the container.

Link copied to clipboard
val image: Output<String>? = null

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

Link copied to clipboard
val init: Output<Boolean>? = null

Configured whether an init process should be injected for this container. If unset this will default to the dockerd defaults.

Link copied to clipboard
val ipcMode: Output<String>? = null

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

Link copied to clipboard
val labels: Output<List<ContainerLabelArgs>>? = null

User-defined key/value metadata

Link copied to clipboard
val links: Output<List<String>>? = null

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

Link copied to clipboard
val logDriver: Output<String>? = null

The logging driver to use for the container.

Link copied to clipboard
val logOpts: Output<Map<String, Any>>? = null

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

Link copied to clipboard
val logs: Output<Boolean>? = null

Save the container logs (attach must be enabled). Defaults to false.

Link copied to clipboard
val maxRetryCount: Output<Int>? = null

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

Link copied to clipboard
val memory: Output<Int>? = null

The memory limit for the container in MBs.

Link copied to clipboard
val memorySwap: Output<Int>? = null

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.

Link copied to clipboard
val mounts: Output<List<ContainerMountArgs>>? = null

Specification for mounts to be added to containers created as part of the service.

Link copied to clipboard
val mustRun: Output<Boolean>? = null

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.

Link copied to clipboard
val name: Output<String>? = null

The name of the container.

Link copied to clipboard
val networkAliases: Output<List<String>>? = null

Set an alias for the container in all specified networks

Link copied to clipboard
val networkMode: Output<String>? = null

Network mode of the container.

Link copied to clipboard
val networks: Output<List<String>>? = null

ID of the networks in which the container is.

Link copied to clipboard

The networks the container is attached to

Link copied to clipboard
val pidMode: Output<String>? = null

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

Link copied to clipboard
val ports: Output<List<ContainerPortArgs>>? = null

Publish a container's port(s) to the host.

Link copied to clipboard
val privileged: Output<Boolean>? = null

If true, the container runs in privileged mode.

Link copied to clipboard
val publishAllPorts: Output<Boolean>? = null

Publish all ports of the container.

Link copied to clipboard
val readOnly: Output<Boolean>? = null

If true, the container will be started as readonly. Defaults to false.

Link copied to clipboard
val removeVolumes: Output<Boolean>? = null

If true, it will remove anonymous volumes associated with the container. Defaults to true.

Link copied to clipboard
val restart: Output<String>? = null

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

Link copied to clipboard
val rm: Output<Boolean>? = null

If true, then the container will be automatically removed when it exits. Defaults to false.

Link copied to clipboard
val runtime: Output<String>? = null

Runtime to use for the container.

Link copied to clipboard
val securityOpts: Output<List<String>>? = null

List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.

Link copied to clipboard
val shmSize: Output<Int>? = null

Size of /dev/shm in MBs.

Link copied to clipboard
val start: Output<Boolean>? = null

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

Link copied to clipboard
val stdinOpen: Output<Boolean>? = null

If true, keep STDIN open even if not attached (docker run -i). Defaults to false.

Link copied to clipboard
val stopSignal: Output<String>? = null

Signal to stop a container (default SIGTERM).

Link copied to clipboard
val stopTimeout: Output<Int>? = null

Timeout (in seconds) to stop a container.

Link copied to clipboard
val storageOpts: Output<Map<String, Any>>? = null

Key/value pairs for the storage driver options, e.g. size: 120G

Link copied to clipboard
val sysctls: Output<Map<String, Any>>? = null

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

Link copied to clipboard
val tmpfs: Output<Map<String, Any>>? = null

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

Link copied to clipboard
val tty: Output<Boolean>? = null

If true, allocate a pseudo-tty (docker run -t). Defaults to false.

Link copied to clipboard
val ulimits: Output<List<ContainerUlimitArgs>>? = null

Ulimit options to add.

Link copied to clipboard
val uploads: Output<List<ContainerUploadArgs>>? = null

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.

Link copied to clipboard
val user: Output<String>? = null

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

Link copied to clipboard
val usernsMode: Output<String>? = null

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

Link copied to clipboard
val volumes: Output<List<ContainerVolumeArgs>>? = null

Spec for mounting volumes in the container.

Link copied to clipboard
val wait: Output<Boolean>? = null

If true, then the Docker container is waited for being healthy state after creation. If false, then the container health state is not checked. Defaults to false.

Link copied to clipboard
val waitTimeout: Output<Int>? = null

The timeout in seconds to wait the container to be healthy after creation. Defaults to 60.

Link copied to clipboard
val workingDir: Output<String>? = null

The working directory for commands to run in.

Functions

Link copied to clipboard
open override fun toJava(): ContainerArgs