{"record":{"id":"fbb9503b3e0102ed","repo":"docker/compose","slug":"interactive-exec-is-not-supported-in-dry-run-mode","errorCode":null,"errorMessage":"interactive exec is not supported in dry-run mode","messagePattern":"interactive exec is not supported in dry-run mode","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/dryrun/dryrunclient.go","lineNumber":339,"sourceCode":"\nfunc (d *DryRunClient) ConfigRemove(ctx context.Context, id string, options client.ConfigRemoveOptions) (client.ConfigRemoveResult, error) {\n\treturn d.apiClient.ConfigRemove(ctx, id, options)\n}\n\nfunc (d *DryRunClient) ConfigUpdate(ctx context.Context, id string, options client.ConfigUpdateOptions) (client.ConfigUpdateResult, error) {\n\treturn d.apiClient.ConfigUpdate(ctx, id, options)\n}\n\nfunc (d *DryRunClient) ContainerCommit(ctx context.Context, container string, options client.ContainerCommitOptions) (client.ContainerCommitResult, error) {\n\treturn d.apiClient.ContainerCommit(ctx, container, options)\n}\n\nfunc (d *DryRunClient) ContainerDiff(ctx context.Context, container string, options client.ContainerDiffOptions) (client.ContainerDiffResult, error) {\n\treturn d.apiClient.ContainerDiff(ctx, container, options)\n}\n\nfunc (d *DryRunClient) ExecAttach(ctx context.Context, execID string, config client.ExecAttachOptions) (client.ExecAttachResult, error) {\n\treturn client.ExecAttachResult{}, errors.New(\"interactive exec is not supported in dry-run mode\")\n}\n\nfunc (d *DryRunClient) ExecInspect(ctx context.Context, execID string, options client.ExecInspectOptions) (client.ExecInspectResult, error) {\n\treturn d.apiClient.ExecInspect(ctx, execID, options)\n}\n\nfunc (d *DryRunClient) ExecResize(ctx context.Context, execID string, options client.ExecResizeOptions) (client.ExecResizeResult, error) {\n\treturn d.apiClient.ExecResize(ctx, execID, options)\n}\n\nfunc (d *DryRunClient) ContainerExport(ctx context.Context, container string, options client.ContainerExportOptions) (client.ContainerExportResult, error) {\n\treturn d.apiClient.ContainerExport(ctx, container, options)\n}\n\nfunc (d *DryRunClient) ContainerLogs(ctx context.Context, container string, options client.ContainerLogsOptions) (client.ContainerLogsResult, error) {\n\treturn d.apiClient.ContainerLogs(ctx, container, options)\n}\n","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/dryrun/dryrunclient.go#L321-L357","documentation":"The dry-run client intentionally blocks ExecAttach because an interactive exec session would perform real I/O with the container and cannot be meaningfully simulated. Static exec calls (create/inspect/resize) pass through, but attaching to the session stream is rejected with 'interactive exec is not supported in dry-run mode'.","triggerScenarios":"`docker compose exec --dry-run <svc> <cmd>` — or any API path reaching ExecAttach — while dry-run mode is enabled.","commonSituations":"Dry-running a script that mixes `compose exec` steps to verify command sequencing; forgetting that --dry-run applies to the whole invocation including exec subcommands.","solutions":["Run exec commands without --dry-run (they are usually safe to test directly)","Model the check with `docker compose exec -T` outside the dry-run pipeline, keeping only up/create steps in the dry-run pass","Use `docker compose run --rm --dry-run svc cmd` to approximate what the exec would launch"],"exampleFix":"# before\ndocker compose --dry-run exec web cat /etc/hostname\n# after\ndocker compose exec web cat /etc/hostname","handlingStrategy":"validation","validationCode":"# in scripts, route exec away from dry-run mode\nif [ \"$DRY_RUN\" = \"1\" ]; then echo 'skipping exec (unsupported in dry-run)'; else docker compose exec \"$@\"; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --dry-run as covering lifecycle commands only (up/build/create), not exec","Document which subcommands your scripts dry-run so interactive ones are excluded"],"tags":["dry-run","exec","interactive"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}