-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec59ed8
commit c1953f5
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Advanced | ||
|
||
## Container Runtime Client | ||
|
||
Testcontainers configures an underlying container runtime to perform its tasks. This runtime works automatically with several providers like Docker, Podman, Colima, Rancher Desktop and Testcontainers Desktop. There are too many usage examples to list here, but here are some common examples: | ||
|
||
### Fetch container runtime information | ||
|
||
```js | ||
import { getContainerRuntimeClient } from "testcontainers"; | ||
|
||
const containerRuntimeClient = await getContainerRuntimeClient(); | ||
|
||
console.log(containerRuntimeClient.info); | ||
``` | ||
|
||
### Pulling an image | ||
|
||
```js | ||
import { ImageName } from "testcontainers"; | ||
|
||
await containerRuntimeClient.image.pull(ImageName.fromString("alpine:3.12")) | ||
``` | ||
|
||
### Starting a container | ||
|
||
```js | ||
const container = await containerRuntimeClient.container.create({ ... }); | ||
await containerRuntimeClient.container.start(container); | ||
``` | ||
|
||
### Starting a Docker Compose environment | ||
|
||
```js | ||
const environment = await containerRuntimeClient.compose.up({ ... }) | ||
``` | ||
|
||
### Starting a network | ||
|
||
```js | ||
const network = await containerRuntimeClient.network.create({ ... }) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters