Skip to content

docker exec -it in AirflowCommand fails in non-interactive shells (pools/connections/variables) #2022

@jremigio-circle

Description

@jremigio-circle

Problem

AirflowCommand() in docker/docker.go hardcodes the -it flags:

cmd := exec.Command(containerRuntime, "exec", "-it", id, "bash", "-c", airflowCommand)

This causes astro dev start to fail when applying airflow_settings.yaml (pools, connections, variables) from any non-interactive environment:

the input device is not a TTY

Affected environments

  • CI/CD pipelines
  • IDE embedded terminals (e.g. Cursor, VS Code tasks)
  • Scripts run via nohup, cron, or process managers
  • Any shell session where stdin is not a terminal (e.g. piped input)

Affected commands

Any operation that goes through settings.AddPools(), settings.AddConnections(), or settings.AddVariables() during astro dev start, as well as astro dev object import.

Expected behavior

astro dev start should successfully apply airflow_settings.yaml regardless of whether the calling shell has a TTY attached.

Suggested fix

Detect whether stdin is a terminal and only pass -it when appropriate, or remove -t entirely since the airflow CLI commands being executed don't require an interactive terminal:

// Option A: detect TTY
args := []string{"exec", "-i"}
if term.IsTerminal(int(os.Stdin.Fd())) {
    args = append(args, "-t")
}
args = append(args, id, "bash", "-c", airflowCommand)
cmd := exec.Command(containerRuntime, args...)
// Option B: just drop -t (simplest, airflow CLI commands don't need it)
cmd := exec.Command(containerRuntime, "exec", "-i", id, "bash", "-c", airflowCommand)

Workaround

Set pools: [] (and/or empty connections/variables) in airflow_settings.yaml to skip the docker exec calls during startup, then configure pools via the Airflow REST API after the webserver is healthy.

Environment

  • Astro CLI: 1.38.1 (also confirmed on main branch / 1.39.0)
  • OS: macOS (darwin arm64)
  • Container runtime: Docker Desktop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions