kompose: Unable to push to Google Cloud
I’ve tried every way to use Kompose, but I’ve always the same issue.
docker-compose.yml (with xxx being my google project name)
version: "3"
services:
book-generator:
image: gcr.io/xxx/book-generator:latest
build: book-generator
ports:
- "5000:5000"
INFO Build key detected. Attempting to build and push image 'gcr.io/xxx/book-generator:latest'
INFO Building image 'gcr.io/xxx/book-generator:latest' from directory 'book-generator'
INFO Image 'gcr.io/xxx/book-generator:latest' from directory 'book-generator' built successfully
INFO Pushing image 'xxx/book-generator:latest' to registry 'gcr.io'
WARN Unable to retrieve .docker/config.json authentication details. Check that 'docker login' works successfully on the command line.: Failed to read authentication from dockercfg
INFO Authentication credentials are not detected. Will try push without authentication.
INFO Attempting authentication credentials 'gcr.io
ERRO Unable to push image 'xxx/book-generator:latest' to registry 'gcr.io'. Error: unauthorized: You don't have the needed permissions to perform this operation, and you may have invalid credentials. To authenticate your request, follow the steps in: https://cloud.google.com/container-registry/docs/advanced-authentication
FATA Error while deploying application: k.Transform failed: Unable to push Docker image for service book-generator: unable to push docker image(s). Check that `docker login` works successfully on the command line
~/.docker/config.json
{
"auths": {
"https://staging-k8s.gcr.io": {},
"https://eu.gcr.io": {},
"https://index.docker.io/v1/": {},
"https://gcr.io": {},
"staging-k8s.gcr.io": {},
"asia.gcr.io": {},
"gcr.io": {},
"k8s.gcr.io": {},
"us.gcr.io": {},
"https://us.gcr.io": {},
"https://k8s.gcr.io": {},
"https://asia.gcr.io": {},
"eu.gcr.io": {}
},
"credHelpers": {
"gcr.io": "gcloud",
"us.gcr.io": "gcloud",
"eu.gcr.io": "gcloud",
"asia.gcr.io": "gcloud",
"staging-k8s.gcr.io": "gcloud"
},
"credsStore": "osxkeychain",
"HttpHeaders": {
"User-Agent": "Docker-Client/18.03.1-ce (darwin)"
}
}
I tried every type of login but I’ve always the same error. What is really surprising is that a direct:
gcloud docker -- push gcr.io/xxx/book-generator:latest works fine
Can you tell me how can I fix this issue ?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 22 (5 by maintainers)
So I solved this on OSX by disabling the keychain password storage:
rm ~/.docker/config.jsondocker loginOr for glcoud and pushing to gcr:
gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.ionow your
~/.docker/config.jsonshould contain base64 encoded passwords. Working, not safe though!If someone gets the keychain storage to work that would be nice…
im also able to
docker loginanddocker push.I configured the docker to be used without sudo, and use
docker pushrather thansudo docker pushit works!Similar thing happened to me. I’m able to push with docker
docker push eu.gcr.io/XXXXXXX-####/containerbut from “kompose up” just hangs on "INFO Attempting authentication credentials 'gcr.io "This is still an issue in Kompose for OSX and gcloud as of Docker Desktop 2.2.0.4. If you’ve done any googling on the topic, you’ll see @wuestkamp’s workaround, which needs a couple tweaks.
credsStorekey in~/.docker/config.jsonThis will force docker to write the auth into the json when you use
docker login. You can’t untickSecurely store Docker logins in macOS keychainin the docker desktop any more – and the currentcredStoreis no longer macOS keychain, it’sdesktop.gcloud auth loginAuth with gcloud (just to be explicit)gcloud auth print-access-token | docker login -u oauth2accesstoken --password-stdin https://eu.gcr.ioYou should see this:
It would be super great to have Kompose use the credential helper properly! /reopen
@wuestkamp manually update to the new version of
Docker Compose. You can get it here. Follow the guideline for manually installing/updating it. Even though the text says that you get the latest one if you are usingDocker Desktop for MacI did not have v1.24 ofDocker Compose. Yes I did try checking for updates.After having updated, when I execute e.g.
docker-compose up --buildI would get a more descriptive error. Suggesting me to actually executegcloud auth loginor set the creds withgcloudto the set I wanted to use. After having done one of the two I was now able to execute thedocker-composecmd I wanted to.I hope the above helps.
@hangyan yes, docker login and docker push works well.