Skip to content

Commit ace19a0

Browse files
Merge branch 'main' into release-11.0.0
2 parents 05baff3 + 574c47b commit ace19a0

File tree

27 files changed

+463
-42
lines changed

27 files changed

+463
-42
lines changed

docs/features/containers.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ const container = await new GenericContainer("alpine")
355355
.withAutoRemove(false)
356356
.start();
357357

358-
await container.stop()
358+
await container.stop();
359359
```
360360

361361
The value specified to `.withAutoRemove()` can be overridden by `.stop()`:
@@ -365,9 +365,12 @@ const container = await new GenericContainer("alpine")
365365
.withAutoRemove(false)
366366
.start();
367367

368-
await container.stop({ remove: true }) // The container is stopped *AND* removed
368+
await container.stop({ remove: true }); // The container is stopped *AND* removed
369369
```
370370

371+
Keep in mind that disabling ryuk (set `TESTCONTAINERS_RYUK_DISABLED` to `true`) **and** disabling automatic removal of containers will make containers persist after you're done working with them.
372+
373+
371374
Volumes created by the container are removed when stopped. This is configurable:
372375

373376
```javascript
@@ -425,6 +428,22 @@ const container2 = await new GenericContainer("alpine")
425428
expect(container1.getId()).toBe(container2.getId());
426429
```
427430

431+
You can also re-use stopped but not removed containers.
432+
433+
```javascript
434+
const container1 = await new GenericContainer("alpine")
435+
.withReuse()
436+
.withAutoRemove(false)
437+
.start();
438+
await container1.stop();
439+
440+
const container2 = await new GenericContainer("alpine")
441+
.withReuse()
442+
.start();
443+
444+
expect(container1.getId()).toBe(container2.getId());
445+
```
446+
428447
Container re-use can be enabled or disabled globally by setting the `TESTCONTAINERS_REUSE_ENABLE` environment variable to `true` or `false`.
429448
If this environment variable is not declared, the feature is enabled by default.
430449

docs/features/images.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@ const container = await GenericContainer
2424
.build("my-custom-image", { deleteOnExit: false });
2525
```
2626

27+
### With buildkit
28+
29+
```javascript
30+
const { GenericContainer } = require("testcontainers");
31+
32+
const container = await GenericContainer
33+
.fromDockerfile("/path/to/build-context")
34+
.withBuildkit()
35+
.build();
36+
```
37+
2738
### With a pull policy
2839

2940
Testcontainers will automatically pull an image if it doesn't exist. This is configurable:
@@ -91,6 +102,15 @@ const container = await GenericContainer
91102
.build();
92103
```
93104

105+
### With platform
106+
107+
```javascript
108+
const container = await GenericContainer
109+
.fromDockerfile("/path/to/build-context")
110+
.withPlatform("linux/amd64")
111+
.build();
112+
```
113+
94114
## Image name substitution
95115

96116
Testcontainers supports automatic substitution of Docker image names.

docs/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
<a href="https://golang.testcontainers.org/" class="card-grid-item"><img src="/site/language-logos/go.svg"/>Go</a>
77
<a href="https://dotnet.testcontainers.org/" class="card-grid-item"><img src="/site/language-logos/dotnet.svg"/>.NET</a>
88
<a class="card-grid-item"><img src="/site/language-logos/nodejs.svg"/>Node.js</a>
9+
<a href="https://cljdoc.org/d/clj-test-containers/clj-test-containers/0.7.4/doc/readme/" class="card-grid-item" ><img src="/site/language-logos/clojure.svg"/>Clojure</a>
10+
<a href="https://github.com/testcontainers/testcontainers-elixir/" class="card-grid-item" ><img src="/site/language-logos/elixir.svg"/>Elixir</a>
11+
<a href="https://github.com/testcontainers/testcontainers-hs/" class="card-grid-item"><img src="/site/language-logos/haskell.svg"/>Haskell</a>
912
<a href="https://testcontainers-python.readthedocs.io/en/latest/" class="card-grid-item"><img src="/site/language-logos/python.svg"/>Python</a>
10-
<a href="https://docs.rs/testcontainers/latest/testcontainers/" class="card-grid-item"><img src="/site/language-logos/rust.svg"/>Rust</a>
11-
<a class="card-grid-item" href="https://github.com/testcontainers/testcontainers-hs/"><img src="/site/language-logos/haskell.svg"/>Haskell</a>
1213
<a href="https://github.com/testcontainers/testcontainers-ruby/" class="card-grid-item" ><img src="/site/language-logos/ruby.svg"/>Ruby</a>
14+
<a href="https://docs.rs/testcontainers/latest/testcontainers/" class="card-grid-item"><img src="/site/language-logos/rust.svg"/>Rust</a>
15+
<a href="https://github.com/testcontainers/testcontainers-php/" class="card-grid-item" ><img src="/site/language-logos/php.svg"/>PHP</a>
16+
<a href="https://github.com/testcontainers/testcontainers-scala/" class="card-grid-item" ><img style="width:30px; height:30px" src="/site/language-logos/scala.svg"/>Scala</a>
1317
</div>
1418

1519
## About
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 47 additions & 0 deletions
Loading

docs/site/language-logos/php.svg

Lines changed: 5 additions & 0 deletions
Loading

docs/site/language-logos/scala.svg

Lines changed: 26 additions & 0 deletions
Loading

packages/modules/azurecosmosdb/src/azure-cosmosdb-emulator-container.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { CosmosClient, PartitionKeyKind } from "@azure/cosmos";
2-
import * as https from "node:https";
3-
import { expect } from "vitest";
2+
import https from "node:https";
43
import { AzureCosmosDbEmulatorContainer } from "./azure-cosmosdb-emulator-container";
54

65
const IMAGE = "mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-EN20250228";

packages/modules/couchbase/src/couchbase-container.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import * as couchbase from "couchbase";
2-
import { Bucket, Cluster } from "couchbase";
1+
import couchbase, { Bucket, Cluster } from "couchbase";
32
import { BucketDefinition } from "./bucket-definition";
43
import { CouchbaseContainer, StartedCouchbaseContainer } from "./couchbase-container";
54
import { CouchbaseService } from "./couchbase-service";

packages/modules/gcloud/src/firestore-emulator-container.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as admin from "firebase-admin";
1+
import admin from "firebase-admin";
22
import { FirestoreEmulatorContainer, StartedFirestoreEmulatorContainer } from "./firestore-emulator-container";
33

44
const IMAGE = "gcr.io/google.com/cloudsdktool/cloud-sdk";

0 commit comments

Comments
 (0)