Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class ResourceReaper {

public static synchronized ResourceReaper instance() {
if (instance == null) {
boolean useRyuk = !Boolean.parseBoolean(System.getenv("TESTCONTAINERS_RYUK_DISABLED"));
boolean useRyuk = !TestcontainersConfiguration.getInstance().isRyukDisabled();
if (useRyuk) {
//noinspection deprecation
instance = new RyukResourceReaper();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ public String getTinyImage() {
return getImage(ALPINE_IMAGE).asCanonicalNameString();
}

public boolean isRyukDisabled() {
return Boolean.parseBoolean(getEnvVarOrProperty("ryuk.disabled", "true"));
}

public boolean isRyukPrivileged() {
return Boolean.parseBoolean(getEnvVarOrProperty("ryuk.container.privileged", "true"));
}
Expand Down
4 changes: 2 additions & 2 deletions docs/features/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ Some companies disallow the usage of Docker Hub, but you can override `*.image`
> In some environments ryuk must be started in privileged mode to work properly (--privileged flag)

### Disabling Ryuk
Ryuk must be started as a privileged container.
Ryuk must be started as a privileged container.
If your environment already implements automatic cleanup of containers after the execution,
but does not allow starting privileged containers, you can turn off the Ryuk container by setting
`TESTCONTAINERS_RYUK_DISABLED` **environment variable** to `true`.
`ryuk.disabled` to `true`.

!!!tip
Note that Testcontainers will continue doing the cleanup at JVM's shutdown, unless you `kill -9` your JVM process.
Expand Down
6 changes: 1 addition & 5 deletions docs/supported_docker_environment/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ Linux:
export DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock
```

If you're running Podman in rootless mode, ensure to include the following line to disable Ryuk:

```bash
export TESTCONTAINERS_RYUK_DISABLED=true
```
If you're running Podman in rootless mode, make sure to [disable Ryuk](/docs/features/configuration/#disabling-ryuk).

!!! note
Previous to version 1.19.0, `export TESTCONTAINERS_RYUK_PRIVILEGED=true`
Expand Down