Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

Service

Import

Example Assuming you created a service as follows #!/bin/bash docker service create –name foo -p 8080:80 nginx # prints th ID 4pcphbxkfn2rffhbhe6czytgi you provide the definition for the resource as follows terraform resource “docker_service” “foo” {

name = “foo”

task_spec {

container_spec {

image = “nginx”

}

}

endpoint_spec {

ports {

target_port

= “80”

published_port = “8080”

}

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

 $ pulumi import docker:index/service:Service foo 4pcphbxkfn2rffhbhe6czytgi

Create a Service Resource

new Service(name: string, args: ServiceArgs, opts?: CustomResourceOptions);
@overload
def Service(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            auth: Optional[ServiceAuthArgs] = None,
            converge_config: Optional[ServiceConvergeConfigArgs] = None,
            endpoint_spec: Optional[ServiceEndpointSpecArgs] = None,
            labels: Optional[Sequence[ServiceLabelArgs]] = None,
            mode: Optional[ServiceModeArgs] = None,
            name: Optional[str] = None,
            rollback_config: Optional[ServiceRollbackConfigArgs] = None,
            task_spec: Optional[ServiceTaskSpecArgs] = None,
            update_config: Optional[ServiceUpdateConfigArgs] = None)
@overload
def Service(resource_name: str,
            args: ServiceArgs,
            opts: Optional[ResourceOptions] = None)
func NewService(ctx *Context, name string, args ServiceArgs, opts ...ResourceOption) (*Service, error)
public Service(string name, ServiceArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ServiceArgs
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 ServiceArgs
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 ServiceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ServiceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Service 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 Service resource accepts the following input properties:

TaskSpec ServiceTaskSpecArgs
User modifiable task configuration
Auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
ConvergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
EndpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
Labels List<ServiceLabelArgs>
User-defined key/value metadata
Mode ServiceModeArgs
Scheduling mode for the service
Name string
Name of the service
RollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
UpdateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
TaskSpec ServiceTaskSpecArgs
User modifiable task configuration
Auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
ConvergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
EndpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
Labels []ServiceLabelArgs
User-defined key/value metadata
Mode ServiceModeArgs
Scheduling mode for the service
Name string
Name of the service
RollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
UpdateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
taskSpec ServiceTaskSpecArgs
User modifiable task configuration
auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
convergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
endpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
labels ServiceLabelArgs[]
User-defined key/value metadata
mode ServiceModeArgs
Scheduling mode for the service
name string
Name of the service
rollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
updateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
task_spec ServiceTaskSpecArgs
User modifiable task configuration
auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
converge_config ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
endpoint_spec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
labels Sequence[ServiceLabelArgs]
User-defined key/value metadata
mode ServiceModeArgs
Scheduling mode for the service
name str
Name of the service
rollback_config ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
update_config ServiceUpdateConfigArgs
Specification for the update strategy of the service

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Service Resource

Get an existing Service 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?: ServiceState, opts?: CustomResourceOptions): Service
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        auth: Optional[ServiceAuthArgs] = None,
        converge_config: Optional[ServiceConvergeConfigArgs] = None,
        endpoint_spec: Optional[ServiceEndpointSpecArgs] = None,
        labels: Optional[Sequence[ServiceLabelArgs]] = None,
        mode: Optional[ServiceModeArgs] = None,
        name: Optional[str] = None,
        rollback_config: Optional[ServiceRollbackConfigArgs] = None,
        task_spec: Optional[ServiceTaskSpecArgs] = None,
        update_config: Optional[ServiceUpdateConfigArgs] = None) -> Service
func GetService(ctx *Context, name string, id IDInput, state *ServiceState, opts ...ResourceOption) (*Service, error)
public static Service Get(string name, Input<string> id, ServiceState? 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:

Auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
ConvergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
EndpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
Labels List<ServiceLabelArgs>
User-defined key/value metadata
Mode ServiceModeArgs
Scheduling mode for the service
Name string
Name of the service
RollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
TaskSpec ServiceTaskSpecArgs
User modifiable task configuration
UpdateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
Auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
ConvergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
EndpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
Labels []ServiceLabelArgs
User-defined key/value metadata
Mode ServiceModeArgs
Scheduling mode for the service
Name string
Name of the service
RollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
TaskSpec ServiceTaskSpecArgs
User modifiable task configuration
UpdateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
convergeConfig ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
endpointSpec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
labels ServiceLabelArgs[]
User-defined key/value metadata
mode ServiceModeArgs
Scheduling mode for the service
name string
Name of the service
rollbackConfig ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
taskSpec ServiceTaskSpecArgs
User modifiable task configuration
updateConfig ServiceUpdateConfigArgs
Specification for the update strategy of the service
auth ServiceAuthArgs
Configuration for the authentication for pulling the images of the service
converge_config ServiceConvergeConfigArgs
A configuration to ensure that a service converges aka reaches the desired that of all task up and running
endpoint_spec ServiceEndpointSpecArgs
Properties that can be configured to access and load balance a service
labels Sequence[ServiceLabelArgs]
User-defined key/value metadata
mode ServiceModeArgs
Scheduling mode for the service
name str
Name of the service
rollback_config ServiceRollbackConfigArgs
Specification for the rollback strategy of the service
task_spec ServiceTaskSpecArgs
User modifiable task configuration
update_config ServiceUpdateConfigArgs
Specification for the update strategy of the service

Supporting Types

ServiceAuth

ServerAddress string
Password string
Username string
ServerAddress string
Password string
Username string
serverAddress string
password string
username string

ServiceConvergeConfig

Delay string
Timeout string
Delay string
Timeout string
delay string
timeout string
delay str
timeout str

ServiceEndpointSpec

ServiceEndpointSpecPort

targetPort number
name string
protocol string
publishMode string
publishedPort number

ServiceLabel

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

ServiceMode

ServiceModeReplicated

replicas number

ServiceRollbackConfig

Delay string
FailureAction string
MaxFailureRatio string
Monitor string
Order string
Parallelism int
Delay string
FailureAction string
MaxFailureRatio string
Monitor string
Order string
Parallelism int
delay string
failureAction string
maxFailureRatio string
monitor string
order string
parallelism number

ServiceTaskSpec

ServiceTaskSpecContainerSpec

ServiceTaskSpecContainerSpecConfig

ConfigId string
FileName string
ConfigName string
FileGid string
FileMode int
FileUid string
ConfigId string
FileName string
ConfigName string
FileGid string
FileMode int
FileUid string
configId string
fileName string
configName string
fileGid string
fileMode number
fileUid string

ServiceTaskSpecContainerSpecDnsConfig

Nameservers List<string>
Options List<string>
Searches List<string>
Nameservers []string
Options []string
Searches []string
nameservers string[]
options string[]
searches string[]
nameservers Sequence[str]
options Sequence[str]
searches Sequence[str]

ServiceTaskSpecContainerSpecHealthcheck

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

ServiceTaskSpecContainerSpecHost

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

ServiceTaskSpecContainerSpecLabel

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

ServiceTaskSpecContainerSpecMount

ServiceTaskSpecContainerSpecMountBindOptions

ServiceTaskSpecContainerSpecMountTmpfsOptions

mode number
sizeBytes number

ServiceTaskSpecContainerSpecMountVolumeOptions

ServiceTaskSpecContainerSpecMountVolumeOptionsLabel

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

ServiceTaskSpecContainerSpecPrivileges

ServiceTaskSpecContainerSpecPrivilegesCredentialSpec

File string
Registry string
File string
Registry string
file string
registry string
file str
registry str

ServiceTaskSpecContainerSpecPrivilegesSeLinuxContext

Disable bool
Level string
Role string
Type string
User string
Disable bool
Level string
Role string
Type string
User string
disable boolean
level string
role string
type string
user string
disable bool
level str
role str
type str
user str

ServiceTaskSpecContainerSpecSecret

FileName string
SecretId string
FileGid string
FileMode int
FileUid string
SecretName string
FileName string
SecretId string
FileGid string
FileMode int
FileUid string
SecretName string
fileName string
secretId string
fileGid string
fileMode number
fileUid string
secretName string

ServiceTaskSpecLogDriver

Name string
Options Dictionary<string, string>
Name string
Options map[string]string
name string
options {[key: string]: string}
name str
options Mapping[str, str]

ServiceTaskSpecPlacement

ServiceTaskSpecPlacementPlatform

Architecture string
Os string
Architecture string
Os string
architecture string
os string

ServiceTaskSpecResources

ServiceTaskSpecResourcesLimits

memoryBytes number
nanoCpus number

ServiceTaskSpecResourcesReservation

ServiceTaskSpecResourcesReservationGenericResources

ServiceTaskSpecRestartPolicy

Condition string
Delay string
MaxAttempts int
Window string
Condition string
Delay string
MaxAttempts int
Window string
condition string
delay string
maxAttempts number
window string

ServiceUpdateConfig

Delay string
FailureAction string
MaxFailureRatio string
Monitor string
Order string
Parallelism int
Delay string
FailureAction string
MaxFailureRatio string
Monitor string
Order string
Parallelism int
delay string
failureAction string
maxFailureRatio string
monitor string
order string
parallelism number

Package Details

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