Container Args
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
Properties
Add or drop certrain linux capabilities.
The total number of milliseconds to wait for the container to reach status 'running'
If defined will attempt to stop the container before destroying. Container will be destroyed after n
seconds or on successful stop.
Bind devices to the container.
DNS search domains that are used when bare unqualified hostnames are used inside of the container.
Domain name of the container.
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"]
.
A test to perform to check that the container is healthy
Additional hosts to add to the container.
User-defined key/value metadata
The maximum amount of times to an attempt a restart when restart
is set to 'on-failure'.
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.
Specification for mounts to be added to containers created as part of the service.
Set an alias for the container in all specified networks
Network mode of the container.
The networks the container is attached to
Publish a container's port(s) to the host.
If true
, the container runs in privileged mode.
Publish all ports of the container.
If true
, it will remove anonymous volumes associated with the container. Defaults to true
.
List of string values to customize labels for MLS systems, such as SELinux. See https://docs.docker.com/engine/reference/run/#security-configuration.
Signal to stop a container (default SIGTERM
).
Timeout (in seconds) to stop a container.
Key/value pairs for the storage driver options, e.g. size
: 120G
Ulimit options to add.
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.
Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
Spec for mounting volumes in the container.
The timeout in seconds to wait the container to be healthy after creation. Defaults to 60
.
The working directory for commands to run in.