8

I am a Docker noob and am trying to run the make dev-services script, declared in the skaffold.yml file (I exchanged image and sha names with xxx):

- name: dev-services
  build:
    tagPolicy:
      inputDigest: {}
    local:
      push: false
      useBuildkit: true
    artifacts:
    - image: gcr.io/xxx/service-base
      context: .
    - image: gcr.io/xxx/api
      context: server/api/
      requires:
        - image: gcr.io/xxx/service-base
          alias: service_base
    - image: gcr.io/xxx/media
      context: server/media/app
      requires:
        - image: gcr.io/xxx/service-base
          alias: service_base
  deploy:
    kustomize:
      paths:
        - ./k8s/local
        - ./server/api/k8s/development
        - ./server/media/k8s/development

When I run it, I get this error:

Building [gcr.io/xxx/media]...
[+] Building 2.8s (4/4) FINISHED                                                                                                                                                                            
 => [internal] load build definition from Dockerfile                                                                                                                                                   0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/alpine:3.14                                                                                                                                         1.2s
 => ERROR [internal] load metadata for gcr.io/xxx/service-base:xxx                                                     2.6s
------
 > [internal] load metadata for gcr.io/xxx/service-base:xxx:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests xxx]: 401 Unauthorized
Building [gcr.io/xxx/api]...
Canceled build for gcr.io/xxx/api
exit status 1. Docker build ran into internal error. Please retry.
If this keeps happening, please open an issue..
make: *** [dev-services] Error 1

Anyone know what might be the problem here? Might it be the google container registry? I'm using Minikube. Is there a Minikube - or Docker - registry that could try? If so, what would I need to change in the skaffold.yaml file?

Thanks a lot in advance :)

cachedcashew
  • 257
  • 2
  • 3
  • 9
  • 3
    Please don't include images to show errors. They are a pain to read. Edit your question with the relevant information as text. – kometen Dec 09 '21 at 11:20
  • 3
    @kometen sorry! I changed the images to text! – cachedcashew Dec 09 '21 at 11:45
  • are you logged in to your container registry? THe error is an auth error with the registry, so likely you are just not logged in. I guess skaffold doesn't log you in, you need to be logged in before running. – MrE Jan 31 '23 at 23:12

4 Answers4

12

running this command rm ~/.docker/config.json before the build worked for me.

Rabbi Musayev
  • 143
  • 1
  • 7
10

for anyone else coming here from windows OS in your docker desktop settings, uncheck the Use Docker Compose V2 this worked for me, i uncheck it works, i checked to try again and make sure that was the issue and yes it was the issue didn't work , until i uncheck again

Swiss bobo
  • 307
  • 1
  • 3
  • 11
7

I got some clue from this thread, however, just want to be precise about the steps you must pay attentions.

  1. Open the Docker Desktop and make sure, you screen looks like this enter image description here
  2. Click Apply & Restart - here is the trick, it doesn't restart infact, follow next step
  3. Right click on the Docker app Icon on the taskbar > click Restart and wait enter image description here
  4. Now retry the ps script, hope this will work for you.
Altaf
  • 189
  • 2
  • 4
1

The error:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests xxx]: 401 Unauthorized

indicates that Docker was unable to get authorization for one of your GCR repositories. Docker will normally get this information from your gcloud settings. There's a couple of reasons why this may fail:

  • You haven't configured Docker for accessing GCR. See the GCR documentation for how to configure access.
  • Your account doesn't have permission to access GCR. See the GCR documentation on configuring access control.
  • Your login details have expired or been revoked. Use gcloud auth login to re-login.
  • You have multiple accounts, and you're using the wrong account. Try gcloud auth list to see your current accounts. You can use gcloud config set account xxx to set the active account, or set the environment CLOUDSDK_CORE_ACCOUNT to set an account for the duration of a session.
Brian de Alwis
  • 2,814
  • 2
  • 18
  • 32