Skip to content

Commit 15ed74b

Browse files
authored
Allow custom docker network (#1291)
1 parent 392453e commit 15ed74b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/docker-provider/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { PostStartCauses, PreStopCauses } from "@trigger.dev/core/v3";
1414
const MACHINE_NAME = process.env.MACHINE_NAME || "local";
1515
const COORDINATOR_PORT = process.env.COORDINATOR_PORT || 8020;
1616
const COORDINATOR_HOST = process.env.COORDINATOR_HOST || "127.0.0.1";
17+
const DOCKER_NETWORK = process.env.DOCKER_NETWORK || "host";
1718

1819
const OTEL_EXPORTER_OTLP_ENDPOINT =
1920
process.env.OTEL_EXPORTER_OTLP_ENDPOINT || "http://0.0.0.0:4318";
@@ -90,7 +91,7 @@ class DockerTaskOperations implements TaskOperations {
9091
logger.debug(
9192
await execa("docker", [
9293
"run",
93-
"--network=host",
94+
`--network=${DOCKER_NETWORK}`,
9495
"--rm",
9596
`--env=INDEX_TASKS=true`,
9697
`--env=TRIGGER_SECRET_KEY=${opts.apiKey}`,
@@ -113,7 +114,7 @@ class DockerTaskOperations implements TaskOperations {
113114

114115
const runArgs = [
115116
"run",
116-
"--network=host",
117+
`--network=${DOCKER_NETWORK}`,
117118
"--detach",
118119
`--env=TRIGGER_ENV_ID=${opts.envId}`,
119120
`--env=TRIGGER_RUN_ID=${opts.runId}`,

0 commit comments

Comments
 (0)