Open chinhvc opened 3 months ago
- Go version:
go1.13.8 linux/amd64
The minimal go version is 1.21: https://github.com/prometheus-community/smartctl_exporter/blob/v0.12.0/go.mod#L3
Yes, I solve the problem after choose to install from official golang webpage. But when I go to next step to create the image, I got the error below:
noname@DESKTOP-I1F3UCB:~/smartctl-agent/smartctl_exporter$ docker build -t smartct
l-agent .
[+] Building 1.1s (7/7) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 373B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3 1.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 2B 0.0s
=> [1/3] FROM docker.io/library/alpine:3@sha256:0a4eaa0eecf5f8c050e5bba433 0.0s
=> => resolve docker.io/library/alpine:3@sha256:0a4eaa0eecf5f8c050e5bba433 0.0s
=> CACHED [2/3] RUN apk add smartmontools 0.0s
=> ERROR [3/3] COPY .build/linux-amd64/smartctl_exporter /bin/smartctl_exp 0.0s
------
> [3/3] COPY .build/linux-amd64/smartctl_exporter /bin/smartctl_exporter:
------
Dockerfile:10
--------------------
8 | ARG ARCH="amd64"
9 | ARG OS="linux"
10 | >>> COPY .build/${OS}-${ARCH}/smartctl_exporter /bin/smartctl_exporter
11 |
12 | EXPOSE 9633
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 9d9d5650-39b1-4cce-ae08-b53dcea83ce0::l1aawhh8c0jy4051q2klniwxf: "/.build/linux-amd64/smartctl_exporter": not found
I can not find the path .build/linux-amd64/smartctl_exporter
so I must to run again go build
with this path
I created the path as requirement and move smartctl_exporter
to this directory.
Run docker build and success created image.
noname@DESKTOP-I1F3UCB:~/smartctl-agent$ mkdir -p .build/linux-amd64/
noname@DESKTOP-I1F3UCB:~/smartctl-agent$ mv smartctl_exporter .build/linux-amd64/
noname@DESKTOP-I1F3UCB:~/smartctl-agent$ ll .build/linux-amd64/smartctl_exporter
-rwxr-xr-x 1 root root 16259919 Aug 20 20:24 .build/linux-amd64/smartctl_exporter*
noname@DESKTOP-I1F3UCB:~/smartctl-agent/smartctl_exporter$ docker build -t smartctl-agent .
[+] Building 8.0s (9/9) FINISHED docker:default
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 373B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3 2.0s
=> [auth] library/alpine:pull token for registry-1.docker.io 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [1/3] FROM docker.io/library/alpine:3@sha256:0a4eaa0eecf5f8c050e5bba433 2.2s
=> => resolve docker.io/library/alpine:3@sha256:0a4eaa0eecf5f8c050e5bba433 0.0s
=> => sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3 1.85kB / 1.85kB 0.0s
=> => sha256:eddacbc7e24bf8799a4ed3cdcfa50d4b88a323695ad80f317 528B / 528B 0.0s
=> => sha256:324bc02ae1231fd9255658c128086395d3fa0aedd5a41 1.47kB / 1.47kB 0.0s
=> => sha256:c6a83fedfae6ed8a4f5f7cbb6a7b6f1c1ec3d86fea8cb 3.62MB / 3.62MB 1.9s
=> => extracting sha256:c6a83fedfae6ed8a4f5f7cbb6a7b6f1c1ec3d86fea8cb9e5ba 0.1s
=> [internal] load build context 0.1s
=> => transferring context: 16.26MB 0.1s
=> [2/3] RUN apk add smartmontools 3.4s
=> [3/3] COPY .build/linux-amd64/smartctl_exporter /bin/smartctl_exporter 0.1s
=> exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:cced7b654416c42f06ac38bc06f00afcf6204bbfa4f40f2 0.0s
=> => naming to docker.io/library/smartctl-agent 0.0s
I run the container from smartctl_exporter
image but got the error messgae
noname@DESKTOP-I1F3UCB:~/smartctl-agent$ docker run --publish 9633:9633 smartctl-agent
exec /bin/smartctl_exporter: no such file or directory
From the docker build logs, it does not show any error when run CP
=> [3/3] COPY .build/linux-amd64/smartctl_exporter /bin/smartctl_exporter 0.1s
So what is my mistake in here?
I try to build smartctl_exporter binary file but has error message below
Basic Information:
VM on VirtualBox
20.04.6 LTS (Focal Fossa)
go1.13.8 linux/amd64
I do not know where to fix the
github.com/prometheus-community/smartctl_exporter
file.