testcontainers 8.16.0 → 9.0.0

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.
Files changed (47) hide show
  1. package/README.md +115 -78
  2. package/dist/bound-ports.d.ts +4 -4
  3. package/dist/docker/docker-client.d.ts +1 -2
  4. package/dist/docker/functions/container/container-logs.js +1 -6
  5. package/dist/docker/functions/container/create-container.d.ts +5 -5
  6. package/dist/docker/functions/container/create-container.js +5 -6
  7. package/dist/docker/functions/container/exec-container.d.ts +2 -2
  8. package/dist/docker/functions/container/get-container.d.ts +1 -2
  9. package/dist/docker/functions/container/inspect-container.d.ts +2 -2
  10. package/dist/docker/functions/create-labels.d.ts +1 -1
  11. package/dist/docker/functions/image/build-image.d.ts +2 -2
  12. package/dist/docker/functions/run-in-container.d.ts +1 -2
  13. package/dist/docker/types.d.ts +23 -22
  14. package/dist/docker-compose/default-docker-compose-options.d.ts +1 -1
  15. package/dist/docker-compose/default-docker-compose-options.js +2 -2
  16. package/dist/docker-compose/docker-compose-options.d.ts +2 -2
  17. package/dist/docker-compose/functions/docker-compose-up.d.ts +1 -1
  18. package/dist/docker-compose-environment/docker-compose-environment.d.ts +5 -5
  19. package/dist/docker-compose-environment/docker-compose-environment.js +11 -11
  20. package/dist/generic-container/generic-container-builder.d.ts +3 -3
  21. package/dist/generic-container/generic-container-builder.js +2 -2
  22. package/dist/generic-container/generic-container.d.ts +16 -17
  23. package/dist/generic-container/generic-container.js +31 -27
  24. package/dist/generic-container/started-generic-container.d.ts +7 -8
  25. package/dist/modules/abstract-started-container.d.ts +6 -7
  26. package/dist/modules/arangodb/arangodb-container.js +2 -2
  27. package/dist/modules/elasticsearch/elasticsearch-container.js +2 -2
  28. package/dist/modules/kafka/kafka-container.d.ts +4 -5
  29. package/dist/modules/kafka/kafka-container.js +41 -34
  30. package/dist/modules/mongodb/mongodb-container.js +1 -1
  31. package/dist/modules/mysql/mysql-container.d.ts +1 -2
  32. package/dist/modules/mysql/mysql-container.js +7 -5
  33. package/dist/modules/nats/nats-container.d.ts +1 -1
  34. package/dist/modules/nats/nats-container.js +2 -2
  35. package/dist/modules/neo4j/neo4j-container.js +10 -4
  36. package/dist/modules/postgresql/postgresql-container.d.ts +1 -2
  37. package/dist/modules/postgresql/postgresql-container.js +5 -3
  38. package/dist/port-binder.d.ts +1 -2
  39. package/dist/port-check.d.ts +4 -6
  40. package/dist/port-forwarder.d.ts +1 -2
  41. package/dist/port-forwarder.js +2 -2
  42. package/dist/port-generator.d.ts +4 -5
  43. package/dist/port.d.ts +3 -5
  44. package/dist/reaper.js +1 -1
  45. package/dist/test-container.d.ts +16 -14
  46. package/dist/test-containers.d.ts +1 -2
  47. package/package.json +29 -25
package/README.md CHANGED
@@ -118,7 +118,10 @@ const { GenericContainer } = require("testcontainers");
118
118
  const buildContext = path.resolve(__dirname, "dir-containing-dockerfile");
119
119
 
120
120
  const container = await GenericContainer.fromDockerfile(buildContext)
121
- .withBuildArg("ARG_KEY", "ARG_VALUE")
121
+ .withBuildArgs({
122
+ ARG_1: "ARG_VALUE_1",
123
+ ARG_2: "ARG_VALUE_2",
124
+ })
122
125
  .build();
123
126
 
124
127
  const startedContainer = await container
@@ -161,12 +164,12 @@ Enabling container reuse, note that two containers are considered equal if their
161
164
  const { GenericContainer } = require("testcontainers");
162
165
 
163
166
  const container1 = await new GenericContainer("alpine")
164
- .withCmd(["sleep", "infinity"])
167
+ .withCommand(["sleep", "infinity"])
165
168
  .withReuse()
166
169
  .start();
167
170
 
168
171
  const container2 = await new GenericContainer("alpine")
169
- .withCmd(["sleep", "infinity"])
172
+ .withCommand(["sleep", "infinity"])
170
173
  .withReuse()
171
174
  .start();
172
175
 
@@ -200,7 +203,7 @@ Creating a container with a command:
200
203
  const { GenericContainer } = require("testcontainers");
201
204
 
202
205
  const container = await new GenericContainer("alpine")
203
- .withCmd(["sleep", "infinity"])
206
+ .withCommand(["sleep", "infinity"])
204
207
  .start();
205
208
  ```
206
209
 
@@ -220,7 +223,7 @@ Execute commands inside a running container:
220
223
  const { GenericContainer } = require("testcontainers");
221
224
 
222
225
  const container = await new GenericContainer("alpine")
223
- .withCmd(["sleep", "infinity"])
226
+ .withCommand(["sleep", "infinity"])
224
227
  .start();
225
228
 
226
229
  const { output, exitCode } = await container.exec(["echo", "hello", "world"]);
@@ -238,7 +241,6 @@ stream
238
241
  .on("data", line => console.log(line))
239
242
  .on("err", line => console.error(line))
240
243
  .on("end", () => console.log("Stream closed"));
241
-
242
244
  ```
243
245
 
244
246
  Creating a container with bind mounts:
@@ -247,8 +249,14 @@ Creating a container with bind mounts:
247
249
  const { GenericContainer } = require("testcontainers");
248
250
 
249
251
  const container = await new GenericContainer("alpine")
250
- .withBindMount("/local/file.txt", "/remote/file.txt")
251
- .withBindMount("/local/dir", "/remote/dir", "ro")
252
+ .withBindMounts([{
253
+ source: "/local/file.txt",
254
+ target:"/remote/file.txt"
255
+ }, {
256
+ source: "/local/dir",
257
+ target:"/remote/dir",
258
+ mode: "ro"
259
+ }])
252
260
  .start();
253
261
  ```
254
262
 
@@ -263,41 +271,6 @@ const container = await new GenericContainer("postgres")
263
271
  .start();
264
272
  ```
265
273
 
266
- Creating a container with ulimits:
267
-
268
- ```javascript
269
- const { GenericContainer } = require("testcontainers");
270
-
271
- const container = await new GenericContainer("aline")
272
- .withUlimits({
273
- memlock: {
274
- hard: -1,
275
- soft: -1
276
- }
277
- })
278
- .start();
279
- ```
280
-
281
- Creating a container with added [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html):
282
-
283
- ```javascript
284
- const { GenericContainer } = require("testcontainers");
285
-
286
- const container = await new GenericContainer("aline")
287
- .withAddedCapabilities("NET_ADMIN", "IPC_LOCK")
288
- .start();
289
- ```
290
-
291
- Creating a container with dropped [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html):
292
-
293
- ```javascript
294
- const { GenericContainer } = require("testcontainers");
295
-
296
- const container = await new GenericContainer("aline")
297
- .withDroppedCapabilities("NET_ADMIN", "IPC_LOCK")
298
- .start();
299
- ```
300
-
301
274
  Copy a file to a container before it is started:
302
275
 
303
276
  ```javascript
@@ -305,8 +278,14 @@ const { GenericContainer } = require("testcontainers");
305
278
 
306
279
  const container = await new GenericContainer("postgres")
307
280
  .withExposedPorts(5432)
308
- .withCopyFileToContainer("/local/file.txt", "/remote/file1.txt")
309
- .withCopyContentToContainer("hello world", "/remote/file2.txt")
281
+ .withCopyFilesToContainer([{
282
+ source: "/local/file.txt",
283
+ target: "/remote/file1.txt"
284
+ }])
285
+ .withCopyContentToContainer([{
286
+ content: "hello world",
287
+ target: "/remote/file2.txt"
288
+ }])
310
289
  .start();
311
290
  ```
312
291
 
@@ -316,7 +295,10 @@ Creating a container with environment variables:
316
295
  const { GenericContainer } = require("testcontainers");
317
296
 
318
297
  const container = await new GenericContainer("alpine")
319
- .withEnv("ENV_KEY", "ENV_VALUE")
298
+ .withEnvironment({
299
+ ENV_1: "ENV_VALUE_1",
300
+ ENV_2: "ENV_VALUE_2",
301
+ })
320
302
  .start();
321
303
  ```
322
304
 
@@ -340,7 +322,7 @@ const { GenericContainer, Wait } = require("testcontainers");
340
322
 
341
323
  const container = await new GenericContainer("alpine")
342
324
  .withHealthCheck({
343
- test: "curl -f http://localhost || exit 1",
325
+ test: ["CMD-SHELL", "curl -f http://localhost || exit 1"],
344
326
  interval: 1000,
345
327
  timeout: 3000,
346
328
  retries: 5,
@@ -350,32 +332,44 @@ const container = await new GenericContainer("alpine")
350
332
  .start();
351
333
  ```
352
334
 
353
- Creating a container that connects to a specific network:
335
+ To execute the `test` in a shell use the form `["CMD-SHELL", "command"]`, for example:
354
336
 
355
337
  ```javascript
356
- const { GenericContainer } = require("testcontainers");
338
+ ["CMD-SHELL", "curl -f http://localhost:8000 || exit 1"]
339
+ ```
357
340
 
358
- const container = await new GenericContainer("alpine")
359
- .withNetworkMode("network_name")
360
- .start();
341
+ To execute the `test` without a shell, use the form: `["CMD", "command", "arg1", "arg2"]`, for example:
342
+
343
+ ```javascript
344
+ ["CMD", "/usr/bin/wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/hello-world"]
361
345
  ```
362
346
 
363
- Create user-defined bridge network and attach the container to it:
347
+ Creating a container within a network:
364
348
 
365
349
  ```javascript
366
350
  const { GenericContainer, Network } = require("testcontainers");
367
351
 
368
352
  const network = await new Network()
369
- .start();
353
+ .start();
370
354
 
371
355
  const container = await new GenericContainer("alpine")
372
- .withNetworkMode(network.getName())
356
+ .withNetwork(network)
373
357
  .start();
374
358
 
375
359
  await container.stop();
376
360
  await network.stop();
377
361
  ```
378
362
 
363
+ Creating a container with a network mode:
364
+
365
+ ```javascript
366
+ const { GenericContainer } = require("testcontainers");
367
+
368
+ const container = await new GenericContainer("alpine")
369
+ .withNetworkMode("bridge")
370
+ .start();
371
+ ```
372
+
379
373
  Communicate to containers on the same network via aliases:
380
374
 
381
375
  ```javascript
@@ -385,17 +379,17 @@ const network = await new Network()
385
379
  .start();
386
380
 
387
381
  const container = await new GenericContainer("alpine")
388
- .withCmd(["sleep", "infinity"])
389
- .withNetworkMode(network.getName())
382
+ .withCommand(["sleep", "infinity"])
383
+ .withNetwork(network)
390
384
  .start();
391
385
 
392
386
  const fooContainer = await new GenericContainer("alpine")
393
- .withCmd(["sleep", "infinity"])
394
- .withNetworkMode(network.getName())
387
+ .withCommand(["sleep", "infinity"])
388
+ .withNetwork(network)
395
389
  .withNetworkAliases("foo", "bar")
396
390
  .start();
397
391
 
398
- expect((await container.exec(["nslookup", "foo"])).exitCode).toBe(0);
392
+ expect((await container.exec(["getent", "hosts", "foo"])).exitCode).toBe(0);
399
393
  ```
400
394
 
401
395
  Add hostname mappings:
@@ -404,14 +398,17 @@ Add hostname mappings:
404
398
  const { GenericContainer } = require("testcontainers");
405
399
 
406
400
  const container = await new GenericContainer("alpine")
407
- .withExtraHosts(
408
- { host: "foo", ipAddress: "10.11.12.13" },
409
- { host: "bar", ipAddress: "11.12.13.14" }
410
- )
401
+ .withExtraHosts([{
402
+ host: "foo",
403
+ ipAddress: "10.11.12.13"
404
+ }, {
405
+ host: "bar",
406
+ ipAddress: "11.12.13.14"
407
+ }])
411
408
  .start();
412
409
 
413
- expect((await container.exec(["nslookup", "foo"])).exitCode).toBe(0);
414
- expect((await container.exec(["nslookup", "bar"])).exitCode).toBe(0);
410
+ expect((await container.exec(["getent", "hosts", "foo"])).exitCode).toBe(0);
411
+ expect((await container.exec(["getent", "hosts", "bar"])).exitCode).toBe(0);
415
412
  ```
416
413
 
417
414
  Specifying a pull policy. Note that if omitted will use the `DefaultPullPolicy` which will use a locally cached image
@@ -470,6 +467,41 @@ const container = await new GenericContainer("alpine")
470
467
  .start();
471
468
  ```
472
469
 
470
+ Creating a container with added [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html):
471
+
472
+ ```javascript
473
+ const { GenericContainer } = require("testcontainers");
474
+
475
+ const container = await new GenericContainer("aline")
476
+ .withAddedCapabilities("NET_ADMIN", "IPC_LOCK")
477
+ .start();
478
+ ```
479
+
480
+ Creating a container with dropped [capabilities](https://man7.org/linux/man-pages/man7/capabilities.7.html):
481
+
482
+ ```javascript
483
+ const { GenericContainer } = require("testcontainers");
484
+
485
+ const container = await new GenericContainer("aline")
486
+ .withDroppedCapabilities("NET_ADMIN", "IPC_LOCK")
487
+ .start();
488
+ ```
489
+
490
+ Creating a container with ulimits:
491
+
492
+ ```javascript
493
+ const { GenericContainer } = require("testcontainers");
494
+
495
+ const container = await new GenericContainer("aline")
496
+ .withUlimits({
497
+ memlock: {
498
+ hard: -1,
499
+ soft: -1
500
+ }
501
+ })
502
+ .start();
503
+ ```
504
+
473
505
  Creating a container with [IPC mode](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc):
474
506
 
475
507
  ```javascript
@@ -518,7 +550,7 @@ const network = await new Network()
518
550
  .start();
519
551
 
520
552
  const container = await new GenericContainer("alpine")
521
- .withNetworkMode(network.getName())
553
+ .withNetwork(network)
522
554
  .start();
523
555
 
524
556
  const networkIpAddress = container.getIpAddress(network.getName());
@@ -539,7 +571,7 @@ server.listen(8000);
539
571
  await TestContainers.exposeHostPorts(8000);
540
572
 
541
573
  const container = await new GenericContainer("alpine")
542
- .withCmd(["sleep", "infinity"])
574
+ .withCommand(["sleep", "infinity"])
543
575
  .start();
544
576
 
545
577
  const { output } = await container.exec(["curl", `http://host.testcontainers.internal:8000`]);
@@ -638,7 +670,8 @@ Once the environment has started, you can interact with the containers as you wo
638
670
  ```javascript
639
671
  const { DockerComposeEnvironment } = require("testcontainers");
640
672
 
641
- const environment = await new DockerComposeEnvironment(composeFilePath, composeFile).up();
673
+ const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
674
+ .up();
642
675
 
643
676
  const container = environment.getContainer("alpine_1");
644
677
  const { output, exitCode } = await container.exec(["echo", "hello", "world"]);
@@ -649,7 +682,8 @@ You can supply [multiple compose files](https://docs.docker.com/compose/extends/
649
682
  ```javascript
650
683
  const { DockerComposeEnvironment } = require("testcontainers");
651
684
 
652
- const environment = await new DockerComposeEnvironment(composeFilePath, [composeFile1, composeFile2]).up();
685
+ const environment = await new DockerComposeEnvironment(composeFilePath, [composeFile1, composeFile2])
686
+ .up();
653
687
 
654
688
  await environment.stop();
655
689
  ```
@@ -659,7 +693,8 @@ If you have multiple docker-compose environments which share dependencies such a
659
693
  ```javascript
660
694
  const { DockerComposeEnvironment } = require("testcontainers");
661
695
 
662
- const environment = await new DockerComposeEnvironment(composeFilePath, composeFile).up();
696
+ const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
697
+ .up();
663
698
 
664
699
  await environment.stop();
665
700
  ```
@@ -718,7 +753,7 @@ Then we can set `TAG` as follows:
718
753
  const { DockerComposeEnvironment } = require("testcontainers");
719
754
 
720
755
  const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
721
- .withEnv("TAG", "value")
756
+ .withEnvironment({ "TAG": "VALUE" })
722
757
  .up();
723
758
  ```
724
759
 
@@ -727,7 +762,8 @@ Testcontainers will not wait for an environment to down, to override:
727
762
  ```javascript
728
763
  const { GenericContainer } = require("testcontainers");
729
764
 
730
- const environment = await new DockerComposeEnvironment(composeFilePath, composeFile).up();
765
+ const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
766
+ .up();
731
767
 
732
768
  await environment.down({
733
769
  timeout: 10000
@@ -739,7 +775,8 @@ Testcontainers will remove associated volumes created by the environment when do
739
775
  ```javascript
740
776
  const { GenericContainer } = require("testcontainers");
741
777
 
742
- const environment = await new DockerComposeEnvironment(composeFilePath, composeFile).up();
778
+ const environment = await new DockerComposeEnvironment(composeFilePath, composeFile)
779
+ .up();
743
780
 
744
781
  await environment.down({
745
782
  removeVolumes: false
@@ -806,10 +843,10 @@ Testcontainers may need to create auxiliary containers to provide its functional
806
843
 
807
844
  To avoid Docker pull limits, you can host your own images and use them by setting the appropriate environment variables:
808
845
 
809
- | Container | Environment Variable | Default
810
- | --- | --- | --- |
811
- | ryuk | `RYUK_CONTAINER_IMAGE` | `testcontainers/ryuk:0.3.2` |
812
- | SSHd | `SSHD_CONTAINER_IMAGE` | `testcontainers/sshd:1.0.0` |
846
+ | Container | Environment Variable | Default |
847
+ |-----------|------------------------|-----------------------------|
848
+ | ryuk | `RYUK_CONTAINER_IMAGE` | `testcontainers/ryuk:0.3.2` |
849
+ | SSHd | `SSHD_CONTAINER_IMAGE` | `testcontainers/sshd:1.0.0` |
813
850
 
814
851
  ### ryuk
815
852
 
@@ -1,10 +1,10 @@
1
- import { Port, PortWithOptionalBinding } from "./port";
1
+ import { PortWithOptionalBinding } from "./port";
2
2
  import { InspectResult } from "./docker/functions/container/inspect-container";
3
3
  export declare class BoundPorts {
4
4
  private readonly ports;
5
- getBinding(port: Port): Port;
6
- setBinding(key: Port, value: Port): void;
7
- iterator(): Iterable<[Port, Port]>;
5
+ getBinding(port: number): number;
6
+ setBinding(key: number, value: number): void;
7
+ iterator(): Iterable<[number, number]>;
8
8
  filter(ports: PortWithOptionalBinding[]): BoundPorts;
9
9
  static fromInspectResult(inspectResult: InspectResult): BoundPorts;
10
10
  }
@@ -1,8 +1,7 @@
1
1
  import Dockerode from "dockerode";
2
- import { Host } from "./types";
3
2
  import "../testcontainers-properties-file";
4
3
  declare type DockerClient = {
5
- host: Host;
4
+ host: string;
6
5
  dockerode: Dockerode;
7
6
  };
8
7
  export declare const dockerClient: () => Promise<DockerClient>;
@@ -15,12 +15,7 @@ const demux_stream_1 = require("../demux-stream");
15
15
  const docker_client_1 = require("../../docker-client");
16
16
  const containerLogs = (container) => __awaiter(void 0, void 0, void 0, function* () {
17
17
  try {
18
- const options = {
19
- follow: true,
20
- stdout: true,
21
- stderr: true,
22
- };
23
- const stream = (yield container.logs(options));
18
+ const stream = (yield container.logs({ follow: true, stdout: true, stderr: true }));
24
19
  stream.socket.unref();
25
20
  return (0, demux_stream_1.demuxStream)((yield (0, docker_client_1.dockerClient)()).dockerode, stream);
26
21
  }
@@ -1,19 +1,19 @@
1
1
  import { DockerImageName } from "../../../docker-image-name";
2
2
  import Dockerode from "dockerode";
3
3
  import { PortWithOptionalBinding } from "../../../port";
4
- import { BindMount, Command, ContainerName, Env, ExtraHost, HealthCheck, Labels, NetworkMode, TmpFs, Ulimits } from "../../types";
4
+ import { BindMount, Environment, ExtraHost, HealthCheck, Labels, TmpFs, Ulimits } from "../../types";
5
5
  export declare type CreateContainerOptions = {
6
6
  imageName: DockerImageName;
7
- env: Env;
8
- cmd: Command[];
7
+ environment: Environment;
8
+ command: string[];
9
9
  entrypoint?: string[];
10
10
  bindMounts: BindMount[];
11
11
  tmpFs: TmpFs;
12
12
  exposedPorts: PortWithOptionalBinding[];
13
- name?: ContainerName;
13
+ name?: string;
14
14
  reusable: boolean;
15
15
  labels?: Labels;
16
- networkMode?: NetworkMode;
16
+ networkMode?: string;
17
17
  healthCheck?: HealthCheck;
18
18
  useDefaultLogDriver: boolean;
19
19
  privilegedMode: boolean;
@@ -22,12 +22,11 @@ const createContainer = (options) => __awaiter(void 0, void 0, void 0, function*
22
22
  name: options.name,
23
23
  User: options.user,
24
24
  Image: options.imageName.toString(),
25
- Env: getEnv(options.env),
25
+ Env: getEnvironment(options.environment),
26
26
  ExposedPorts: getExposedPorts(options.exposedPorts),
27
- Cmd: options.cmd,
27
+ Cmd: options.command,
28
28
  Entrypoint: options.entrypoint,
29
29
  Labels: (0, create_labels_1.createLabels)(options.reusable, options.imageName, options.labels),
30
- // @ts-ignore
31
30
  Healthcheck: getHealthCheck(options.healthCheck),
32
31
  HostConfig: {
33
32
  IpcMode: options.ipcMode,
@@ -51,7 +50,7 @@ const createContainer = (options) => __awaiter(void 0, void 0, void 0, function*
51
50
  }
52
51
  });
53
52
  exports.createContainer = createContainer;
54
- const getEnv = (env) => Object.entries(env).reduce((dockerodeEnvironment, [key, value]) => [...dockerodeEnvironment, `${key}=${value}`], []);
53
+ const getEnvironment = (environment) => Object.entries(environment).reduce((dockerodeEnvironment, [key, value]) => [...dockerodeEnvironment, `${key}=${value}`], []);
55
54
  const getExposedPorts = (exposedPorts) => {
56
55
  const dockerodeExposedPorts = {};
57
56
  for (const exposedPort of exposedPorts) {
@@ -75,14 +74,14 @@ const getPortBindings = (exposedPorts) => {
75
74
  return dockerodePortBindings;
76
75
  };
77
76
  const getBindMounts = (bindMounts) => {
78
- return bindMounts.map(({ source, target, bindMode }) => `${source}:${target}:${bindMode}`);
77
+ return bindMounts.map(({ source, target, mode }) => `${source}:${target}:${mode}`);
79
78
  };
80
79
  const getHealthCheck = (healthCheck) => {
81
80
  if (healthCheck === undefined) {
82
81
  return undefined;
83
82
  }
84
83
  return {
85
- Test: ["CMD-SHELL", healthCheck.test],
84
+ Test: healthCheck.test,
86
85
  Interval: healthCheck.interval ? toNanos(healthCheck.interval) : 0,
87
86
  Timeout: healthCheck.timeout ? toNanos(healthCheck.timeout) : 0,
88
87
  Retries: healthCheck.retries || 0,
@@ -1,9 +1,9 @@
1
- import { Command, ExecResult } from "../../types";
1
+ import { ExecResult } from "../../types";
2
2
  import Dockerode from "dockerode";
3
3
  declare type ExecContainerOptions = {
4
4
  tty: boolean;
5
5
  stdin: boolean;
6
6
  detach: boolean;
7
7
  };
8
- export declare const execContainer: (container: Dockerode.Container, command: Command[], options: ExecContainerOptions, shouldLog?: boolean) => Promise<ExecResult>;
8
+ export declare const execContainer: (container: Dockerode.Container, command: string[], options: ExecContainerOptions, shouldLog?: boolean) => Promise<ExecResult>;
9
9
  export {};
@@ -1,4 +1,3 @@
1
1
  import Dockerode from "dockerode";
2
- import { Id } from "../../types";
3
- export declare const getContainerById: (id: Id) => Promise<Dockerode.Container>;
2
+ export declare const getContainerById: (id: string) => Promise<Dockerode.Container>;
4
3
  export declare const getContainerByHash: (hash: string) => Promise<Dockerode.Container | undefined>;
@@ -1,7 +1,7 @@
1
- import { ContainerName, HealthCheckStatus, Labels, NetworkSettings, Ports } from "../../types";
1
+ import { HealthCheckStatus, Labels, NetworkSettings, Ports } from "../../types";
2
2
  import Dockerode from "dockerode";
3
3
  export declare type InspectResult = {
4
- name: ContainerName;
4
+ name: string;
5
5
  hostname: string;
6
6
  ports: Ports;
7
7
  healthCheckStatus: HealthCheckStatus;
@@ -1,3 +1,3 @@
1
1
  import { DockerImageName } from "../../docker-image-name";
2
2
  import { Labels } from "../types";
3
- export declare const createLabels: (reusable: boolean, dockerImageName?: DockerImageName | undefined, extraLabels?: Labels) => Labels;
3
+ export declare const createLabels: (reusable: boolean, dockerImageName?: DockerImageName, extraLabels?: Labels) => Labels;
@@ -1,9 +1,9 @@
1
1
  import { DockerImageName } from "../../../docker-image-name";
2
2
  import { PullPolicy } from "../../../pull-policy";
3
- import { BuildArgs, BuildContext, RegistryConfig } from "../../types";
3
+ import { BuildArgs, RegistryConfig } from "../../types";
4
4
  export declare type BuildImageOptions = {
5
5
  imageName: DockerImageName;
6
- context: BuildContext;
6
+ context: string;
7
7
  dockerfileName: string;
8
8
  buildArgs: BuildArgs;
9
9
  pullPolicy: PullPolicy;
@@ -1,3 +1,2 @@
1
- import { Command } from "../types";
2
1
  import Dockerode from "dockerode";
3
- export declare const runInContainer: (dockerode: Dockerode, image: string, command: Command[]) => Promise<string | undefined>;
2
+ export declare const runInContainer: (dockerode: Dockerode, image: string, command: string[]) => Promise<string | undefined>;
@@ -1,19 +1,26 @@
1
- export declare type Id = string;
2
- export declare type Host = string;
3
- export declare type EnvKey = string;
4
- export declare type EnvValue = string;
5
- export declare type Env = {
6
- [key in EnvKey]: EnvValue;
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Readable } from "stream";
4
+ export declare type Environment = {
5
+ [key in string]: string;
7
6
  };
8
- export declare type Dir = string;
9
7
  export declare type BindMode = "rw" | "ro" | "z" | "Z";
10
8
  export declare type BindMount = {
11
- source: Dir;
12
- target: Dir;
13
- bindMode: BindMode;
9
+ source: string;
10
+ target: string;
11
+ mode?: BindMode;
12
+ };
13
+ export declare type FileToCopy = {
14
+ source: string;
15
+ target: string;
16
+ };
17
+ export declare type Content = string | Buffer | Readable;
18
+ export declare type ContentToCopy = {
19
+ content: Content;
20
+ target: string;
14
21
  };
15
22
  export declare type TmpFs = {
16
- [dir in Dir]: Dir;
23
+ [dir in string]: string;
17
24
  };
18
25
  export declare type Ulimits = {
19
26
  [name: string]: {
@@ -22,18 +29,16 @@ export declare type Ulimits = {
22
29
  };
23
30
  };
24
31
  export declare type HealthCheck = {
25
- test: string;
32
+ test: ["CMD-SHELL", string] | ["CMD", ...string[]];
26
33
  interval?: number;
27
34
  timeout?: number;
28
35
  retries?: number;
29
36
  startPeriod?: number;
30
37
  };
31
38
  export declare type ExtraHost = {
32
- host: Host;
39
+ host: string;
33
40
  ipAddress: string;
34
41
  };
35
- export declare type NetworkMode = string;
36
- export declare type ContainerName = string;
37
42
  export declare type Labels = {
38
43
  [key: string]: string;
39
44
  };
@@ -52,16 +57,12 @@ export declare type RegistryConfig = {
52
57
  password: string;
53
58
  };
54
59
  };
55
- export declare type BuildContext = string;
56
60
  export declare type BuildArgs = {
57
- [key in EnvKey]: EnvValue;
61
+ [key in string]: string;
58
62
  };
59
- export declare type StreamOutput = string;
60
- export declare type ExitCode = number;
61
- export declare type Command = string;
62
63
  export declare type ExecResult = {
63
- output: StreamOutput;
64
- exitCode: ExitCode;
64
+ output: string;
65
+ exitCode: number;
65
66
  };
66
67
  export declare type HealthCheckStatus = "none" | "starting" | "unhealthy" | "healthy";
67
68
  export declare type NetworkSettings = {
@@ -1,3 +1,3 @@
1
1
  import { IDockerComposeOptions } from "./docker-compose";
2
2
  import { DockerComposeOptions } from "./docker-compose-options";
3
- export declare const defaultDockerComposeOptions: ({ env, ...options }: DockerComposeOptions) => Partial<IDockerComposeOptions>;
3
+ export declare const defaultDockerComposeOptions: ({ environment, ...options }: DockerComposeOptions) => Partial<IDockerComposeOptions>;
@@ -13,14 +13,14 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.defaultDockerComposeOptions = void 0;
15
15
  const defaultDockerComposeOptions = (_a) => {
16
- var { env = {} } = _a, options = __rest(_a, ["env"]);
16
+ var { environment = {} } = _a, options = __rest(_a, ["environment"]);
17
17
  return {
18
18
  log: false,
19
19
  cwd: options.filePath,
20
20
  config: options.files,
21
21
  composeOptions: options.composeOptions,
22
22
  commandOptions: options.commandOptions,
23
- env: Object.assign(Object.assign(Object.assign({}, process.env), { COMPOSE_PROJECT_NAME: options.projectName }), env),
23
+ env: Object.assign(Object.assign(Object.assign({}, process.env), { COMPOSE_PROJECT_NAME: options.projectName }), environment),
24
24
  };
25
25
  };
26
26
  exports.defaultDockerComposeOptions = defaultDockerComposeOptions;
@@ -1,9 +1,9 @@
1
- import { Env } from "../docker/types";
1
+ import { Environment } from "../docker/types";
2
2
  export declare type DockerComposeOptions = {
3
3
  filePath: string;
4
4
  files: string | string[];
5
5
  projectName: string;
6
6
  commandOptions?: string[];
7
7
  composeOptions?: string[];
8
- env?: Env;
8
+ environment?: Environment;
9
9
  };
@@ -1,2 +1,2 @@
1
1
  import { DockerComposeOptions } from "../docker-compose-options";
2
- export declare const dockerComposeUp: (options: DockerComposeOptions, services?: string[] | undefined) => Promise<void>;
2
+ export declare const dockerComposeUp: (options: DockerComposeOptions, services?: Array<string>) => Promise<void>;