skaffold icon indicating copy to clipboard operation
skaffold copied to clipboard

skaffold requires docker daemon even when no docker usage is requested

Open joeholley opened this issue 2 years ago • 0 comments

Expected behavior

When the command given to skaffold does not require the use of dockerd or minikube, it would be nice if it recognized that fact and skipped trying to initialize them and tried to take the requested action. What if, for example, a user had a compelling reason to do their dev loop without using the local environment at all?

Actual behavior

Not only does it try to initialize minikube even when it's not needed for the requested operation, it hard exits if it can't contact dockerd and never attempts the requested operation at all.

Information

  • Skaffold version: v2.9.0
  • Operating system: latest glinux
  • Installed via: skaffold quickstart instructions
  • Contents of skaffold.yaml:
apiVersion: skaffold/v4beta8
kind: Config

metadata:
  name: gcb-test

build:

  platforms: ["linux/amd64"]

  googleCloudBuild:
    projectId: fm-test02

  artifacts:
    - image: asia-northeast1-docker.pkg.dev/<project_redacted>/<registry_redacted>/om-core
      buildpacks:
        clearCache: false
        projectDescriptor: project.toml
        trustBuilder: false

Steps to reproduce the behavior

  1. Clone any quickstart for cloud run that uses GCB + buildpacks. Use the included cloudbuild.yaml to validate your build and auth are working and the build can run successfully.
  2. add a minimal skaffold.yaml file to do GCB builds via skaffold, like the one above.
  3. make sure the local docker daemon is stopped.
  4. skaffold build -v debug
  5. Error:
INFO[0000] Skaffold &{Version:v2.9.0 ConfigVersion:skaffold/v4beta8 GitVersion: GitCommit:6071a3f7574702c8666a243d89254e9b0d8ff4d7 BuildDate:2023-11-07T13:13:24Z GoVersion:go1.21.0 Compiler:gc Platform:linux/amd64 User:}  subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/usr/local/google/home/joeholley/.skaffold/config"  subtask=-1 task=DevLoop
DEBU[0000] parsed 1 configs from configuration file /usr/local/google/home/joeholley/Documents/repos/open-match.dev/open-match/skaffold.yaml  subtask=-1 task=DevLoop
DEBU[0000] Defaulting deploy type to kubectl             subtask=-1 task=DevLoop
INFO[0000] map entry found when executing locate for &{asia-northeast1-docker.pkg.dev/x/x/om-core . 0xc000485ab0 {<nil> <nil> <nil> <nil> <nil> 0xc0005f2750 <nil>} [] {[] []} [] } of type *latest.Artifact and pointer: 824644875344  subtask=-1 task=DevLoop
INFO[0000] Using kubectl context: minikube               subtask=-1 task=DevLoop
DEBU[0000] getting client config for kubeContext: `minikube`  subtask=-1 task=DevLoop
DEBU[0003] getting client config for kubeContext: `minikube`  subtask=-1 task=DevLoop
DEBU[0006] Running command: [minikube version --output=json]  subtask=-1 task=DevLoop
DEBU[0006] Command output: [{"commit":"fd3f3801765d093a485d255043149f92ec0a695f","minikubeVersion":"v1.31.1"}
]  subtask=-1 task=DevLoop
DEBU[0006] Running command: [/usr/local/bin/minikube docker-env --shell none -p minikube --user=skaffold]  subtask=-1 task=DevLoop
DEBU[0006] Running command: [tput colors]                subtask=-1 task=DevLoop
DEBU[0006] Command output: [8
]                          subtask=-1 task=DevLoop
invalid skaffold config: getting minikube env: running [/usr/local/bin/minikube docker-env --shell none -p minikube --user=skaffold]
 - stdout: "false exit code 80\n"
 - stderr: "X Exiting due to GUEST_STATUS: Unable to get machine status: state: unknown state \"minikube\": docker container inspect minikube --format=<no value>: exit status 1\nstdout:\n\n\nstderr:\nCannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?\n\n* \n╭─────────────────────────────────────────────────────────────────────────────────────────────╮\n│                                                                                             │\n│    * If the above advice does not help, please let us know:                                 │\n│      https://github.com/kubernetes/minikube/issues/new/choose                               │\n│                                                                                             │\n│    * Please run `minikube logs --file=logs.txt` and attach logs.txt to the GitHub issue.    │\n│    * Please also attach the following file to the GitHub issue:                             │\n│    * - /tmp/minikube_docker-env_65bc3c3ef655b0de188744ba046ac571854af53e_0.log              │\n│                                                                                             │\n╰─────────────────────────────────────────────────────────────────────────────────────────────╯\n"
 - cause: exit status 80
DEBU[0006] exporting metrics disabled                    subtask=-1 task=DevLoop

joeholley avatar Jan 29 '24 08:01 joeholley