umputun/sys-agent

Docker client version 1.22 is too old

Closed this issue · 2 comments

In the code docker client version is hardcoded as 1.22

resp, err := client.Get("http://localhost/v1.22/containers/json")

In fresh Docker I have error "client version 1.22 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version" so sys-agent can not parse docker response

2024/01/29 20:36:56.955 [WARN] service request failed: docker docker:///var/run/docker.sock?containers=xxxxxxxxxxx: docker parsing failed: docker docker:///var/run/docker.sock?containers=xxxxxxxxxx: docker ummarshal failed: invalid character 'c' looking for beginning of value

docker version
Client: Docker Engine - Community
 Version:           25.0.1
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Tue Jan 23 23:10:32 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          25.0.1
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       71fa3ab
  Built:            Tue Jan 23 23:09:31 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.27
  GitCommit:        a1496014c916f9e62104b33d1bb5bd03b0858e59
 runc:
  Version:          1.1.11
  GitCommit:        v1.1.11-0-g4bccb38
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Maybe needed upgrade docker client version in request from 1.22 to 1.24 or make it configurable (not sure)?

Also maybe is good idea add checking for 404 error in docker request and not try to parse json in case of 404.

It was merged in and released as a part of 1.4.0. Pls check it out and see if all good

Checked — works fine. Thanks!