Skip to content

Commit 221aca4

Browse files
Add support for TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE for ryuk (#205)
1 parent 0da0438 commit 221aca4

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ The following environment variables are supported:
2121
| `DEBUG` | `testcontainers` | See output |
2222
| `DEBUG` | `testcontainers:containers` | See container output |
2323
| `DEBUG` | `testcontainers*` | See all output |
24-
| `DOCKER_HOST` | `tcp://docker:2375` | Override the Docker host |
24+
| `DOCKER_HOST` | `tcp://docker:2375` | Daemon socket to connect to |
25+
| `TESTCONTAINERS_HOST_OVERRIDE` | `docker.svc.local` | Docker's host on which ports are exposed |
26+
| `TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE` | `/var/run/docker.sock` | Path to Docker's socket. Used by Ryuk and a few other containers that need to perform Docker actions
2527
| `TESTCONTAINERS_RYUK_DISABLED` | `true` | Disable [ryuk](#ryuk) |
26-
| `TESTCONTAINERS_HOST_OVERRIDE` | `docker.svc.local` | Override Docker's host on which ports are exposed |
2728
| `RYUK_CONTAINER_IMAGE` | `registry.mycompany.com/mirror/ryuk:0.3.0` | Custom image for [ryuk](#ryuk) |
2829
| `SSHD_CONTAINER_IMAGE` | `registry.mycompany.com/mirror/sshd:1.0.0` | Custom image for [SSHd](#SSHd) |
2930

src/reaper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ export class ReaperInstance {
8080
private static async createRealInstance(dockerClient: DockerClient): Promise<Reaper> {
8181
const sessionId = dockerClient.getSessionId();
8282

83+
const dockerSocket = process.env["TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE"] ?? "/var/run/docker.sock";
84+
8385
log.debug(`Creating new Reaper for session: ${sessionId}`);
8486
const container = await new GenericContainer(this.getImage())
8587
.withName(`testcontainers-ryuk-${sessionId}`)
8688
.withExposedPorts(8080)
8789
.withWaitStrategy(Wait.forLogMessage("Started!"))
88-
.withBindMount("/var/run/docker.sock", "/var/run/docker.sock")
90+
.withBindMount(dockerSocket, "/var/run/docker.sock")
8991
.withDaemonMode()
9092
.withPrivilegedMode()
9193
.start();

0 commit comments

Comments
 (0)