usage-metrics-collector icon indicating copy to clipboard operation
usage-metrics-collector copied to clipboard

docker image build error

Open googs1025 opened this issue 1 year ago • 5 comments

I found an error during the compilation of the Docker image, following the steps in the README documentation. Is this error because the go version is not forward compatible?

go version: 1.22 k8s version: v1.29.2 ubuntu 22

root@VM-0-8-ubuntu:/home/ubuntu/usage-metrics-collector# docker build . -t usage-metrics-collector:v0.0.0
[+] Building 74.5s (14/18)                                                                                                                                                                             docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                             0.0s
 => => transferring dockerfile: 804B                                                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/alpine:3.17                                                                                                                                                   0.7s
 => [internal] load metadata for docker.io/library/golang:1.19                                                                                                                                                   0.7s
 => [internal] load .dockerignore                                                                                                                                                                                0.0s
 => => transferring context: 2B                                                                                                                                                                                  0.0s
 => [build 1/7] FROM docker.io/library/golang:1.19@sha256:3025bf670b8363ec9f1b4c4f27348e6d9b7fec607c47e401e40df816853e743a                                                                                       0.0s
 => [stage-1 1/6] FROM docker.io/library/alpine:3.17@sha256:a6063e988bcd597b4f1f7cfd4ec38402b02edd0c79250f00c9e14dc1e94bebbc                                                                                     0.0s
 => [internal] load build context                                                                                                                                                                                0.0s
 => => transferring context: 63.82kB                                                                                                                                                                             0.0s
 => CACHED [stage-1 2/6] RUN apk --no-cache add curl # install for debugging -- not required to run                                                                                                              0.0s
 => CACHED [build 2/7] WORKDIR /workspace                                                                                                                                                                        0.0s
 => CACHED [build 3/7] COPY go.mod ./                                                                                                                                                                            0.0s
 => CACHED [build 4/7] COPY go.sum ./                                                                                                                                                                            0.0s
 => CACHED [build 5/7] RUN go mod download                                                                                                                                                                       0.0s
 => CACHED [build 6/7] COPY . .                                                                                                                                                                                  0.0s
 => ERROR [build 7/7] RUN make build-docker                                                                                                                                                                     73.7s
------
 > [build 7/7] RUN make build-docker:
18.28 go: no main packages to build
50.67 # sigs.k8s.io/controller-runtime/pkg/cache
50.67 /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/cache.go:412:58: fields.Selector does not implement comparable
50.67 /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/cache.go:442:20: fields.Selector does not implement comparable
50.67 note: module requires Go 1.20
60.71 # sigs.k8s.io/controller-runtime/pkg/cache
60.71 /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/cache.go:412:58: fields.Selector does not implement comparable
60.71 /go/pkg/mod/sigs.k8s.io/[email protected]/pkg/cache/cache.go:442:20: fields.Selector does not implement comparable
60.71 note: module requires Go 1.20
73.52 make: *** [Makefile:97: build-docker] Error 1
------
Dockerfile:24
--------------------
  22 |     # Build and test code
  23 |     COPY . .
  24 | >>> RUN make build-docker
  25 |
  26 |     FROM alpine:3.17
--------------------
ERROR: failed to solve: process "/bin/sh -c make build-docker" did not complete successfully: exit code: 2
root@VM-0-8-ubuntu:/home/ubuntu/usage-metrics-collector# go version
go version go1.22.3 linux/amd64
root@VM-0-8-ubuntu:/home/ubuntu/usage-metrics-collector#

root@VM-0-8-ubuntu:/home/ubuntu/usage-metrics-collector# kubectl get node
NAME                     STATUS   ROLES           AGE   VERSION
cluster1-control-plane   Ready    control-plane   27m   v1.29.2
cluster1-worker          Ready    <none>          26m   v1.29.2
cluster1-worker2         Ready    <none>          26m   v1.29.2
root@VM-0-8-ubuntu:/home/ubuntu/usage-metrics-collector# kind version
kind v0.23.0 go1.21.10 linux/amd64

googs1025 avatar Jul 04 '24 13:07 googs1025

/kind support

googs1025 avatar Jul 04 '24 13:07 googs1025

/triage accepted

googs1025 avatar Jul 04 '24 13:07 googs1025

/help

googs1025 avatar Jul 05 '24 00:07 googs1025

@googs1025: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jul 05 '24 00:07 k8s-ci-robot

Have you tried using Go 1.20 to build?

ehashman avatar Jul 24 '24 17:07 ehashman

/close

googs1025 avatar Feb 02 '25 05:02 googs1025

@googs1025: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Feb 02 '25 05:02 k8s-ci-robot