Use this pattern for CI jobs that render diagrams without host installation.
docker run --rm -it \
-v "$(pwd):/workspace" \
-w /workspace \
ubuntu:24.04 bash -lc "apt update && apt install -y curl && curl -fsSL https://d2lang.com/install.sh | sh -s -- && d2 input.d2 output.svg"