Using a turbo task via `turbo run` to invoke a package.json script that calls `docker compose build` results in a docker build `error: Command failed with exit code 17`
dainmik opened this issue · 3 comments
dainmik commented
Verify canary release
- I verified that the issue exists in the latest Turborepo canary release.
Link to code that reproduces this issue
https://github.com/dainmik/turbo-task-docker-build-error-repro
Which canary version will you have in your reproduction?
2.3.3
Enviroment information
CLI:
Version: 2.3.3
Path to executable: /workspaces/docker-in-docker-12/repo/node_modules/.pnpm/turbo-linux-64@2.3.3/node_modules/turbo-linux-64/bin/turbo
Daemon status: Running
Package manager: pnpm9
Platform:
Architecture: x86_64
Operating system: linux
WSL: false
Available memory (MB): 52011
Available CPU cores: 32
Environment:
CI: None
Terminal (TERM): xterm-256color
Terminal program (TERM_PROGRAM): vscode
Terminal program version (TERM_PROGRAM_VERSION): 1.95.3
Shell (SHELL): /bin/bash
stdin: false
Expected behavior
Running turbo --filter=api build:docker
from the repo root should execute the command without any errors.
Actual behavior
Running turbo --filter=api build:docker
from the repo root results in the following Docker error:
api:build:docker: ------
api:build:docker: > [api internal] load metadata for docker.io/library/node:18-alpine:
api:build:docker: ------
api:build:docker: failed to solve: node:18-alpine: failed to resolve source metadata for docker.io/library/node:18-alpine: error getting credentials - err: exit status 255, out: ``
api:build:docker: ELIFECYCLE Command failed with exit code 17.
api:build:docker: ERROR: command finished with error: command (/workspaces/docker-in-docker-12/repo/apps/api) /usr/local/share/nvm/versions/node/v22.11.0/bin/pnpm run build:docker exited (17)
api#build:docker: command (/workspaces/docker-in-docker-12/repo/apps/api) /usr/local/share/nvm/versions/node/v22.11.0/bin/pnpm run build:docker exited (17)
To Reproduce
Reproduction repo: https://github.com/dainmik/turbo-task-docker-build-error-repro
Steps to reproduce:
- Clone the repo.
- Run
cd repo && pnpm install
- Run
turbo --filter=api build:docker
from the root. - Observe the error in the terminal.
Additional context
Running other variations also produce this error:
turbo run build:docker
turbo build:docker
But running via pnpm
or calling docker compose build
directly works as expected:
pnpm run --filter api build:docker
from the root.cd apps/api && docker compose build
I'm using Docker version 27.0.3-1
NicholasLYang commented
Hi, thanks for the issue. Can you try running with --env-mode=loose
? I suspect there are some environment variables that are not being properly forwarded to your docker process.