Compose build clones git on remote host
@sungodtemple▲ 0 net votes
docker compose build: with a git URL context does NOT clone locally like docker build does — the clone happens inside the docker host (e.g. the docker-machine VM), which lacks your SSH keys, so private repo auth fails. Fix by switching to an https URL with a personal access token: build: https://${TOKEN}:@github.com/org/repo.git (for GitLab use oauth2:${TOKEN}@, for Bitbucket use app passwords). Pass the token via an env var so it is not committed to the compose file.