Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash: Invalid version. Must be a string. Got type "object" while checking docker server version. #5284

Closed
AmauryD opened this issue Oct 20, 2023 · 2 comments · Fixed by #5288

Comments

@AmauryD
Copy link
Contributor

AmauryD commented Oct 20, 2023

Crash report

Error message

While trying to build images locally, I ran into this issue:

Failed processing Build type=container name=worker (took 0.5 sec). This is what happened:
TypeError: Invalid version. Must be a string. Got type "object".
    at new SemVer (/snapshot/pkg/node_modules/semver/classes/semver.js:19:13)
    at compare (/snapshot/pkg/node_modules/semver/functions/compare.js:3:3)
    at Object.gte (/snapshot/pkg/node_modules/semver/functions/gte.js:2:30)
    at checkMinDockerVersion (/snapshot/pkg/core/build/src/plugins/container/helpers.js:404:29)
    at Object.checkDockerServerVersion (/snapshot/pkg/core/build/src/plugins/container/helpers.js:260:19)
    at AsyncFunction.buildContainer (/snapshot/pkg/core/build/src/plugins/container/build.js:32:32)
    at async localBuild (/snapshot/pkg/core/build/src/plugins/kubernetes/container/build/local.js:66:25)
    at async Object.assign.handlerType.handlerType (/snapshot/pkg/core/build/src/router/base.js:202:28)
    at async Router.callHandler (/snapshot/pkg/core/build/src/router/base.js:173:24)
    at async build (/snapshot/pkg/core/build/src/router/build.js:51:24)
    at async /snapshot/pkg/core/build/src/util/open-telemetry/spans.js:46:20
    at async BuildTask.process (/snapshot/pkg/core/build/src/tasks/build.js:61:32)
    at async descriptor.value (/snapshot/pkg/core/build/src/tasks/base.js:319:29)
    at async /snapshot/pkg/core/build/src/util/open-telemetry/decorators.js:47:30
    at async ProcessTaskNode.execute (/snapshot/pkg/core/build/src/graph/nodes.js:214:35)
    at async GraphSolver.processNode (/snapshot/pkg/core/build/src/graph/solver.js:281:35)

What did you do?

I was able to reproduce the same issue from the repository https://github.com/garden-io/quickstart-example by simply running:

garden build --env=local

Your environment

  • OS: MACOS 14.0
  • How I'm running Kubernetes: Docker Desktop
  • Garden version: 0.13.18

Docker desktop:

Engine: 24.0.6
Compose: v2.22.0-desktop.2
Credential Helper: v0.7.0
Kubernetes: v1.27.2

Frequency

Always

Workaround

Not found.

@AmauryD
Copy link
Contributor Author

AmauryD commented Oct 20, 2023

It appears that the command docker version -f "{{ .Server.Version }}" returns 'dev'.

https://github.com/garden-io/garden/blob/main/core/src/plugins/container/build.ts#L38

  // { client: '24.0.6', server: 'dev' }
  containerHelpers.checkDockerServerVersion(await containerHelpers.getDockerVersion())

Resetting Docker desktop to factory defaults fixed the problem. Something was probably corrupted at some point.

@AmauryD AmauryD closed this as completed Oct 20, 2023
@stefreak
Copy link
Member

stefreak commented Oct 20, 2023

Nonetheless, Garden should not crash encountering an invalid version, but emit a warning or something like that.

@AmauryD Thanks a lot for reporting this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants