@pulumi/docker 4.11.0 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/container.d.ts +31 -21
- package/container.js +22 -21
- package/container.js.map +1 -1
- package/getRemoteImage.d.ts +2 -2
- package/getRemoteImage.js +2 -2
- package/image.d.ts +6 -0
- package/image.js +6 -0
- package/image.js.map +1 -1
- package/network.d.ts +15 -11
- package/network.js +15 -11
- package/network.js.map +1 -1
- package/package.json +2 -2
- package/plugin.d.ts +2 -3
- package/plugin.js +2 -3
- package/plugin.js.map +1 -1
- package/registryImage.d.ts +9 -0
- package/registryImage.js.map +1 -1
- package/remoteImage.d.ts +77 -0
- package/remoteImage.js +68 -0
- package/remoteImage.js.map +1 -1
- package/secret.d.ts +23 -1
- package/secret.js +23 -1
- package/secret.js.map +1 -1
- package/service.d.ts +279 -24
- package/service.js +279 -24
- package/service.js.map +1 -1
- package/serviceConfig.d.ts +34 -14
- package/serviceConfig.js +34 -14
- package/serviceConfig.js.map +1 -1
- package/types/input.d.ts +3 -0
- package/types/output.d.ts +3 -0
- package/volume.d.ts +15 -11
- package/volume.js +15 -11
- package/volume.js.map +1 -1
package/remoteImage.js
CHANGED
|
@@ -5,6 +5,74 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
exports.RemoteImage = void 0;
|
|
6
6
|
const pulumi = require("@pulumi/pulumi");
|
|
7
7
|
const utilities = require("./utilities");
|
|
8
|
+
/**
|
|
9
|
+
* <!-- Bug: Type and Name are switched -->
|
|
10
|
+
* Manages the lifecycle of a docker image in your docker host. It can be used to build a new docker image or to pull an existing one from a registry.
|
|
11
|
+
* This resource will *not* pull new layers of the image automatically unless used in conjunction with docker.RegistryImage data source to update the `pullTriggers` field.
|
|
12
|
+
*
|
|
13
|
+
* ## Example Usage
|
|
14
|
+
*
|
|
15
|
+
* ### Basic
|
|
16
|
+
*
|
|
17
|
+
* Finds and downloads the latest `ubuntu:precise` image but does not check
|
|
18
|
+
* for further updates of the image
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
22
|
+
* import * as docker from "@pulumi/docker";
|
|
23
|
+
*
|
|
24
|
+
* const ubuntu = new docker.RemoteImage("ubuntu", {name: "ubuntu:precise"});
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ### Dynamic updates
|
|
28
|
+
*
|
|
29
|
+
* To be able to update an image dynamically when the `sha256` sum changes,
|
|
30
|
+
* you need to use it in combination with `docker.RegistryImage` as follows:
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
34
|
+
* import * as docker from "@pulumi/docker";
|
|
35
|
+
*
|
|
36
|
+
* const ubuntu = docker.getRegistryImage({
|
|
37
|
+
* name: "ubuntu:precise",
|
|
38
|
+
* });
|
|
39
|
+
* const ubuntuRemoteImage = new docker.RemoteImage("ubuntu", {
|
|
40
|
+
* name: ubuntu.then(ubuntu => ubuntu.name),
|
|
41
|
+
* pullTriggers: [ubuntu.then(ubuntu => ubuntu.sha256Digest)],
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* ### Build
|
|
46
|
+
*
|
|
47
|
+
* You can also use the resource to build an image. If you want to use a buildx builder with all of its features, please read the section below.
|
|
48
|
+
*
|
|
49
|
+
* > **Note**: The default timeout for the building is 20 minutes. If you need to increase this, you can use operation timeouts.
|
|
50
|
+
*
|
|
51
|
+
* In this case the image "zoo" and "zoo:develop" are built.
|
|
52
|
+
* The `context` and `dockerfile` arguments are relative to the local Terraform process (`path.cwd`).
|
|
53
|
+
* There is no need to copy the files to remote hosts before creating the resource.
|
|
54
|
+
*
|
|
55
|
+
* ```typescript
|
|
56
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
57
|
+
* import * as docker from "@pulumi/docker";
|
|
58
|
+
*
|
|
59
|
+
* const zoo = new docker.RemoteImage("zoo", {
|
|
60
|
+
* name: "zoo",
|
|
61
|
+
* build: {
|
|
62
|
+
* context: ".",
|
|
63
|
+
* tags: ["zoo:develop"],
|
|
64
|
+
* buildArgs: {
|
|
65
|
+
* foo: "zoo",
|
|
66
|
+
* },
|
|
67
|
+
* label: {
|
|
68
|
+
* author: "zoo",
|
|
69
|
+
* },
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* You can use the `triggers` argument to specify when the image should be rebuild. This is for example helpful when you want to rebuild the docker image whenever the source code changes.
|
|
75
|
+
*/
|
|
8
76
|
class RemoteImage extends pulumi.CustomResource {
|
|
9
77
|
/**
|
|
10
78
|
* Get an existing RemoteImage resource's state with the given name, ID, and optional extra
|
package/remoteImage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteImage.js","sourceRoot":"","sources":["../remoteImage.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,yCAAyC;AAEzC,MAAa,WAAY,SAAQ,MAAM,CAAC,cAAc;IAClD;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAA2B,EAAE,KAAwB,EAAE,IAAmC;QACtH,OAAO,IAAI,WAAW,CAAC,IAAI,EAAO,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAClE,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,UAAU,CAAC,GAAQ;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,GAAG,CAAC,cAAc,CAAC,KAAK,WAAW,CAAC,YAAY,CAAC;IAC5D,CAAC;
|
|
1
|
+
{"version":3,"file":"remoteImage.js","sourceRoot":"","sources":["../remoteImage.ts"],"names":[],"mappings":";AA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s from "./types/input";
|
|
3
3
|
import * as outputs from "./types/output";
|
|
4
4
|
/**
|
|
5
|
+
* <!-- Bug: Type and Name are switched -->
|
|
6
|
+
* Manages the secrets of a Docker service in a swarm.
|
|
7
|
+
*
|
|
8
|
+
* ## Example Usage
|
|
9
|
+
*
|
|
10
|
+
* ### Basic
|
|
11
|
+
*
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
14
|
+
* import * as docker from "@pulumi/docker";
|
|
15
|
+
* import * as std from "@pulumi/std";
|
|
16
|
+
*
|
|
17
|
+
* const foo = new docker.Secret("foo", {
|
|
18
|
+
* name: "foo",
|
|
19
|
+
* data: std.index.base64encode({
|
|
20
|
+
* input: "{\"foo\": \"s3cr3t\"}",
|
|
21
|
+
* }).result,
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
5
25
|
* ## Import
|
|
6
26
|
*
|
|
27
|
+
* ```sh
|
|
7
28
|
* #!/bin/bash
|
|
8
29
|
*
|
|
9
|
-
* Docker secret cannot be imported as the secret data, once set, is never exposed again.
|
|
30
|
+
* # Docker secret cannot be imported as the secret data, once set, is never exposed again.
|
|
31
|
+
* ```
|
|
10
32
|
*/
|
|
11
33
|
export declare class Secret extends pulumi.CustomResource {
|
|
12
34
|
/**
|
package/secret.js
CHANGED
|
@@ -6,11 +6,33 @@ exports.Secret = void 0;
|
|
|
6
6
|
const pulumi = require("@pulumi/pulumi");
|
|
7
7
|
const utilities = require("./utilities");
|
|
8
8
|
/**
|
|
9
|
+
* <!-- Bug: Type and Name are switched -->
|
|
10
|
+
* Manages the secrets of a Docker service in a swarm.
|
|
11
|
+
*
|
|
12
|
+
* ## Example Usage
|
|
13
|
+
*
|
|
14
|
+
* ### Basic
|
|
15
|
+
*
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
18
|
+
* import * as docker from "@pulumi/docker";
|
|
19
|
+
* import * as std from "@pulumi/std";
|
|
20
|
+
*
|
|
21
|
+
* const foo = new docker.Secret("foo", {
|
|
22
|
+
* name: "foo",
|
|
23
|
+
* data: std.index.base64encode({
|
|
24
|
+
* input: "{\"foo\": \"s3cr3t\"}",
|
|
25
|
+
* }).result,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
9
29
|
* ## Import
|
|
10
30
|
*
|
|
31
|
+
* ```sh
|
|
11
32
|
* #!/bin/bash
|
|
12
33
|
*
|
|
13
|
-
* Docker secret cannot be imported as the secret data, once set, is never exposed again.
|
|
34
|
+
* # Docker secret cannot be imported as the secret data, once set, is never exposed again.
|
|
35
|
+
* ```
|
|
14
36
|
*/
|
|
15
37
|
class Secret extends pulumi.CustomResource {
|
|
16
38
|
/**
|
package/secret.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../secret.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,yCAAyC;AAEzC
|
|
1
|
+
{"version":3,"file":"secret.js","sourceRoot":"","sources":["../secret.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF;;;AAEjF,yCAAyC;AAIzC,yCAAyC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,MAAO,SAAQ,MAAM,CAAC,cAAc;IAC7C;;;;;;;;OAQG;IACI,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAA2B,EAAE,KAAmB,EAAE,IAAmC;QACjH,OAAO,IAAI,MAAM,CAAC,IAAI,EAAO,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;IAKD;;;OAGG;IACI,MAAM,CAAC,UAAU,CAAC,GAAQ;QAC7B,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE;YACnC,OAAO,KAAK,CAA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IAAI,CAAC,CAAC;IAC3D,CAAC;;AAtEL,wBAuEC;AAzDG,gBAAgB;AACO,mBAAY,GAAG,4BAA4B,CAAC"}
|
package/service.d.ts
CHANGED
|
@@ -2,55 +2,310 @@ import * as pulumi from "@pulumi/pulumi";
|
|
|
2
2
|
import * as inputs from "./types/input";
|
|
3
3
|
import * as outputs from "./types/output";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* <!-- Bug: Type and Name are switched -->
|
|
6
|
+
* This resource manages the lifecycle of a Docker service. By default, the creation, update and delete of services are detached.
|
|
7
|
+
* With the Converge Config the behavior of the `docker cli` is imitated to guarantee tha for example, all tasks of a service are running or successfully updated or to inform `terraform` that a service could no be updated and was successfully rolled back.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
9
|
+
* ## Example Usage
|
|
8
10
|
*
|
|
9
|
-
*
|
|
11
|
+
* ### Basic
|
|
10
12
|
*
|
|
11
|
-
*
|
|
13
|
+
* The following configuration starts a Docker Service with
|
|
12
14
|
*
|
|
13
|
-
*
|
|
15
|
+
* - the given image,
|
|
16
|
+
* - 1 replica
|
|
17
|
+
* - exposes the port `8080` in `vip` mode to the host machine
|
|
18
|
+
* - moreover, uses the `container` runtime
|
|
14
19
|
*
|
|
15
|
-
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
22
|
+
* import * as docker from "@pulumi/docker";
|
|
16
23
|
*
|
|
17
|
-
*
|
|
24
|
+
* const foo = new docker.Service("foo", {
|
|
25
|
+
* name: "foo-service",
|
|
26
|
+
* taskSpec: {
|
|
27
|
+
* containerSpec: {
|
|
28
|
+
* image: "repo.mycompany.com:8080/foo-service:v1",
|
|
29
|
+
* },
|
|
30
|
+
* },
|
|
31
|
+
* endpointSpec: {
|
|
32
|
+
* ports: [{
|
|
33
|
+
* targetPort: 8080,
|
|
34
|
+
* }],
|
|
35
|
+
* },
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
18
38
|
*
|
|
19
|
-
*
|
|
39
|
+
* The following command is the equivalent:
|
|
20
40
|
*
|
|
21
|
-
*
|
|
41
|
+
* ### Basic with Datasource
|
|
22
42
|
*
|
|
23
|
-
*
|
|
43
|
+
* Alternatively, if the image is already present on the Docker Host and not managed
|
|
44
|
+
* by `terraform`, you can also use the `docker.RemoteImage` datasource:
|
|
24
45
|
*
|
|
25
|
-
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
48
|
+
* import * as docker from "@pulumi/docker";
|
|
26
49
|
*
|
|
27
|
-
*
|
|
50
|
+
* const foo = docker.getRemoteImage({
|
|
51
|
+
* name: "repo.mycompany.com:8080/foo-service:v1",
|
|
52
|
+
* });
|
|
53
|
+
* const fooService = new docker.Service("foo", {
|
|
54
|
+
* name: "foo-service",
|
|
55
|
+
* taskSpec: {
|
|
56
|
+
* containerSpec: {
|
|
57
|
+
* image: foo.then(foo => foo.repoDigest),
|
|
58
|
+
* },
|
|
59
|
+
* },
|
|
60
|
+
* endpointSpec: {
|
|
61
|
+
* ports: [{
|
|
62
|
+
* targetPort: 8080,
|
|
63
|
+
* }],
|
|
64
|
+
* },
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
28
67
|
*
|
|
29
|
-
*
|
|
68
|
+
* ### Advanced
|
|
30
69
|
*
|
|
31
|
-
*
|
|
70
|
+
* The following configuration shows the full capabilities of a Docker Service,
|
|
71
|
+
* with a `volume`, `config`, `secret` and `network`
|
|
32
72
|
*
|
|
33
|
-
*
|
|
73
|
+
* ```typescript
|
|
74
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
75
|
+
* import * as docker from "@pulumi/docker";
|
|
34
76
|
*
|
|
35
|
-
*
|
|
77
|
+
* const testVolume = new docker.Volume("test_volume", {name: "tftest-volume"});
|
|
78
|
+
* const testVolume2 = new docker.Volume("test_volume_2", {name: "tftest-volume2"});
|
|
79
|
+
* const serviceConfig = new docker.ServiceConfig("service_config", {
|
|
80
|
+
* name: "tftest-full-myconfig",
|
|
81
|
+
* data: "ewogICJwcmVmaXgiOiAiMTIzIgp9",
|
|
82
|
+
* });
|
|
83
|
+
* const serviceSecret = new docker.Secret("service_secret", {
|
|
84
|
+
* name: "tftest-mysecret",
|
|
85
|
+
* data: "ewogICJrZXkiOiAiUVdFUlRZIgp9",
|
|
86
|
+
* });
|
|
87
|
+
* const testNetwork = new docker.Network("test_network", {
|
|
88
|
+
* name: "tftest-network",
|
|
89
|
+
* driver: "overlay",
|
|
90
|
+
* });
|
|
91
|
+
* const foo = new docker.Service("foo", {
|
|
92
|
+
* name: "tftest-service-basic",
|
|
93
|
+
* taskSpec: {
|
|
94
|
+
* containerSpec: {
|
|
95
|
+
* configs: [
|
|
96
|
+
* {
|
|
97
|
+
* configId: serviceConfig.id,
|
|
98
|
+
* configName: serviceConfig.name,
|
|
99
|
+
* fileName: "/configs.json",
|
|
100
|
+
* },
|
|
101
|
+
* {},
|
|
102
|
+
* ],
|
|
103
|
+
* secrets: [
|
|
104
|
+
* {
|
|
105
|
+
* secretId: serviceSecret.id,
|
|
106
|
+
* secretName: serviceSecret.name,
|
|
107
|
+
* fileName: "/secrets.json",
|
|
108
|
+
* fileUid: "0",
|
|
109
|
+
* fileGid: "0",
|
|
110
|
+
* fileMode: 777,
|
|
111
|
+
* },
|
|
112
|
+
* {},
|
|
113
|
+
* ],
|
|
114
|
+
* image: "repo.mycompany.com:8080/foo-service:v1",
|
|
115
|
+
* labels: [{
|
|
116
|
+
* label: "foo.bar",
|
|
117
|
+
* value: "baz",
|
|
118
|
+
* }],
|
|
119
|
+
* commands: ["ls"],
|
|
120
|
+
* args: ["-las"],
|
|
121
|
+
* hostname: "my-fancy-service",
|
|
122
|
+
* env: {
|
|
123
|
+
* MYFOO: "BAR",
|
|
124
|
+
* },
|
|
125
|
+
* dir: "/root",
|
|
126
|
+
* user: "root",
|
|
127
|
+
* groups: [
|
|
128
|
+
* "docker",
|
|
129
|
+
* "foogroup",
|
|
130
|
+
* ],
|
|
131
|
+
* privileges: {
|
|
132
|
+
* seLinuxContext: {
|
|
133
|
+
* disable: true,
|
|
134
|
+
* user: "user-label",
|
|
135
|
+
* role: "role-label",
|
|
136
|
+
* type: "type-label",
|
|
137
|
+
* level: "level-label",
|
|
138
|
+
* },
|
|
139
|
+
* },
|
|
140
|
+
* readOnly: true,
|
|
141
|
+
* mounts: [
|
|
142
|
+
* {
|
|
143
|
+
* target: "/mount/test",
|
|
144
|
+
* source: testVolume.name,
|
|
145
|
+
* type: "bind",
|
|
146
|
+
* readOnly: true,
|
|
147
|
+
* bindOptions: {
|
|
148
|
+
* propagation: "rprivate",
|
|
149
|
+
* },
|
|
150
|
+
* },
|
|
151
|
+
* {
|
|
152
|
+
* target: "/mount/test2",
|
|
153
|
+
* source: testVolume2.name,
|
|
154
|
+
* type: "volume",
|
|
155
|
+
* readOnly: true,
|
|
156
|
+
* volumeOptions: {
|
|
157
|
+
* noCopy: true,
|
|
158
|
+
* labels: [{
|
|
159
|
+
* label: "foo",
|
|
160
|
+
* value: "bar",
|
|
161
|
+
* }],
|
|
162
|
+
* driverName: "random-driver",
|
|
163
|
+
* driverOptions: {
|
|
164
|
+
* op1: "val1",
|
|
165
|
+
* },
|
|
166
|
+
* },
|
|
167
|
+
* },
|
|
168
|
+
* ],
|
|
169
|
+
* stopSignal: "SIGTERM",
|
|
170
|
+
* stopGracePeriod: "10s",
|
|
171
|
+
* healthcheck: {
|
|
172
|
+
* tests: [
|
|
173
|
+
* "CMD",
|
|
174
|
+
* "curl",
|
|
175
|
+
* "-f",
|
|
176
|
+
* "http://localhost:8080/health",
|
|
177
|
+
* ],
|
|
178
|
+
* interval: "5s",
|
|
179
|
+
* timeout: "2s",
|
|
180
|
+
* retries: 4,
|
|
181
|
+
* },
|
|
182
|
+
* hosts: [{
|
|
183
|
+
* host: "testhost",
|
|
184
|
+
* ip: "10.0.1.0",
|
|
185
|
+
* }],
|
|
186
|
+
* dnsConfig: {
|
|
187
|
+
* nameservers: ["8.8.8.8"],
|
|
188
|
+
* searches: ["example.org"],
|
|
189
|
+
* options: ["timeout:3"],
|
|
190
|
+
* },
|
|
191
|
+
* },
|
|
192
|
+
* resources: {
|
|
193
|
+
* limits: {
|
|
194
|
+
* nanoCpus: 1000000,
|
|
195
|
+
* memoryBytes: 536870912,
|
|
196
|
+
* },
|
|
197
|
+
* reservation: {
|
|
198
|
+
* nanoCpus: 1000000,
|
|
199
|
+
* memoryBytes: 536870912,
|
|
200
|
+
* genericResources: {
|
|
201
|
+
* namedResourcesSpecs: ["GPU=UUID1"],
|
|
202
|
+
* discreteResourcesSpecs: ["SSD=3"],
|
|
203
|
+
* },
|
|
204
|
+
* },
|
|
205
|
+
* },
|
|
206
|
+
* restartPolicy: {
|
|
207
|
+
* condition: "on-failure",
|
|
208
|
+
* delay: "3s",
|
|
209
|
+
* maxAttempts: 4,
|
|
210
|
+
* window: "10s",
|
|
211
|
+
* }[0],
|
|
212
|
+
* placement: {
|
|
213
|
+
* constraints: ["node.role==manager"],
|
|
214
|
+
* prefs: ["spread=node.role.manager"],
|
|
215
|
+
* maxReplicas: 1,
|
|
216
|
+
* },
|
|
217
|
+
* forceUpdate: 0,
|
|
218
|
+
* runtime: "container",
|
|
219
|
+
* networks: [testNetwork.id],
|
|
220
|
+
* logDriver: {
|
|
221
|
+
* name: "json-file",
|
|
222
|
+
* options: {
|
|
223
|
+
* "max-size": "10m",
|
|
224
|
+
* "max-file": "3",
|
|
225
|
+
* },
|
|
226
|
+
* },
|
|
227
|
+
* },
|
|
228
|
+
* mode: {
|
|
229
|
+
* replicated: {
|
|
230
|
+
* replicas: 2,
|
|
231
|
+
* },
|
|
232
|
+
* },
|
|
233
|
+
* updateConfig: {
|
|
234
|
+
* parallelism: 2,
|
|
235
|
+
* delay: "10s",
|
|
236
|
+
* failureAction: "pause",
|
|
237
|
+
* monitor: "5s",
|
|
238
|
+
* maxFailureRatio: "0.1",
|
|
239
|
+
* order: "start-first",
|
|
240
|
+
* },
|
|
241
|
+
* rollbackConfig: {
|
|
242
|
+
* parallelism: 2,
|
|
243
|
+
* delay: "5ms",
|
|
244
|
+
* failureAction: "pause",
|
|
245
|
+
* monitor: "10h",
|
|
246
|
+
* maxFailureRatio: "0.9",
|
|
247
|
+
* order: "stop-first",
|
|
248
|
+
* },
|
|
249
|
+
* endpointSpec: {
|
|
250
|
+
* ports: [
|
|
251
|
+
* {
|
|
252
|
+
* name: "random",
|
|
253
|
+
* protocol: "tcp",
|
|
254
|
+
* targetPort: 8080,
|
|
255
|
+
* publishedPort: 8080,
|
|
256
|
+
* publishMode: "ingress",
|
|
257
|
+
* },
|
|
258
|
+
* {},
|
|
259
|
+
* ],
|
|
260
|
+
* mode: "vip",
|
|
261
|
+
* },
|
|
262
|
+
* });
|
|
263
|
+
* ```
|
|
36
264
|
*
|
|
37
|
-
*
|
|
265
|
+
* ## Import
|
|
38
266
|
*
|
|
39
|
-
*
|
|
267
|
+
* !/bin/bash
|
|
40
268
|
*
|
|
41
|
-
*
|
|
269
|
+
* ```sh
|
|
270
|
+
* $ pulumi import docker:index/service:Service foo id
|
|
271
|
+
* ```
|
|
42
272
|
*
|
|
43
|
-
*
|
|
273
|
+
* ### Example
|
|
274
|
+
*
|
|
275
|
+
* Assuming you created a `service` as follows
|
|
276
|
+
*
|
|
277
|
+
* ```sh
|
|
278
|
+
* #!/bin/bash
|
|
279
|
+
* docker service create --name foo -p 8080:80 nginx
|
|
280
|
+
* # prints th ID
|
|
281
|
+
* 4pcphbxkfn2rffhbhe6czytgi
|
|
282
|
+
* ```
|
|
44
283
|
*
|
|
45
|
-
*
|
|
284
|
+
* you provide the definition for the resource as follows
|
|
46
285
|
*
|
|
47
|
-
*
|
|
286
|
+
* ```typescript
|
|
287
|
+
* import * as pulumi from "@pulumi/pulumi";
|
|
288
|
+
* import * as docker from "@pulumi/docker";
|
|
48
289
|
*
|
|
49
|
-
*
|
|
290
|
+
* const foo = new docker.Service("foo", {
|
|
291
|
+
* name: "foo",
|
|
292
|
+
* taskSpec: {
|
|
293
|
+
* containerSpec: {
|
|
294
|
+
* image: "nginx",
|
|
295
|
+
* },
|
|
296
|
+
* },
|
|
297
|
+
* endpointSpec: {
|
|
298
|
+
* ports: [{
|
|
299
|
+
* targetPort: 80,
|
|
300
|
+
* publishedPort: 8080,
|
|
301
|
+
* }],
|
|
302
|
+
* },
|
|
303
|
+
* });
|
|
304
|
+
* ```
|
|
50
305
|
*
|
|
51
306
|
* then the import command is as follows
|
|
52
307
|
*
|
|
53
|
-
*
|
|
308
|
+
* !/bin/bash
|
|
54
309
|
*
|
|
55
310
|
* ```sh
|
|
56
311
|
* $ pulumi import docker:index/service:Service foo 4pcphbxkfn2rffhbhe6czytgi
|