docker-compose up --build -d --remove-orphans failing


docker-compose up --build -d --remove-orphans is failing with the following error

% docker-compose up --build -d --remove-orphans
Building foo
Traceback (most recent call last):
  File "docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main 
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 1085, in up
  File "compose/cli/main.py", line 1081, in up
  File "compose/project.py", line 527, in up
  File "compose/service.py", line 344, in ensure_image_exists
  File "compose/service.py", line 1084, in build
  File "site-packages/docker/api/build.py", line 260, in build
  File "site-packages/docker/api/build.py", line 307, in _set_auth_headers
  File "site-packages/docker/auth.py", line 310, in get_all_credentials
  File "site-packages/docker/auth.py", line 262, in _resolve_authconfig_credstore
  File "site-packages/docker/auth.py", line 287, in _get_store_instance
  File "site-packages/dockerpycreds/store.py", line 25, in __init__
dockerpycreds.errors.InitializationError: docker-credential-gcloud not installed or not available in PATH
[1425] Failed to execute script docker-compose

My docker-compose content looks like following

version: "3"

services:
  foo:
    build: .
    stdin_open: true
    tty: true
    command: nodemon --delay 6 index.js

1 Answer

5 years ago by

After a little struggle figured out the gcloud sdk is missing (after migrating to new MacBook) hence I need to fix my ~/.docker/config.json

Following is the content from the file

{
  "credHelpers" : {
    "us.gcr.io" : "gcloud",
    "asia.gcr.io" : "gcloud",
    "marketplace.gcr.io" : "gcloud",
    "eu.gcr.io" : "gcloud",
    "staging-k8s.gcr.io" : "gcloud",
    "gcr.io" : "gcloud"
  },
  "credsStore" : "desktop",
  "stackOrchestrator" : "swarm",
  "auths" : {
    "https://xxxxxx.dkr.ecr.us-xxxx-x.amazonaws.com" : {

    }
  },
  "credSstore" : "osxkeychain",
  "HttpHeaders" : {
    "User-Agent" : "Docker-Client/18.09.2 (darwin)"
  }
}

And I have removed the credHelpers section. Which fixed the issue.

5 years ago by Karthik Divi