Migrate the Docker client to github.com/moby/moby

Move docker-machine off github.com/docker/docker, for the next release, v0.16.2-gitlab.68. That module has no releases after v28.5.2, and its known vulnerabilities have no fix in that module path, because the code is published as github.com/moby/moby now. This removes the docker/docker findings from the docker-machine binary in the GitLab Runner images. See https://gitlab.com/gitlab-org/ci-cd/docker-machine/-/work_items/152.

  • libmachine/mcndockerclient uses github.com/moby/moby/client v0.6.3, and libmachine/provision/configure_swarm.go uses the github.com/moby/moby/api container and network types. These are the only two places that imported docker/docker.
  • ImagePull now waits for the pull to finish before the container is created. The old code did not read the pull response.
  • The swarm host port is parsed once with network.ParsePort, and a port that is not valid returns an error.
  • golang.org/x/crypto goes to v0.58.1-0.20261009181718-2f1f834330b2, from v0.59.0. That is v0.58.0 plus the upstream commit that moves x/crypto/openpgp into its own module, so it has the fix for GO-2026-5932 and keeps DSA keys and the ssh-dss host key algorithm, which v0.59.0 removes from x/crypto/ssh.
  • The two pull errors are wrapped with %w, and the 2375/tcp port is parsed with network.ParsePort, which returns an error instead of panicking.
  • New v0.16.2-gitlab.68 section in CHANGELOG.md, and Version in version/version.go.
Checks
  • go mod why -m github.com/docker/docker: the main module does not need it, and go.sum has no github.com/docker/docker line.
  • Trivy on the linux/amd64 binary: no findings.
  • govulncheck -mode binary: GO-2022-0635 and GO-2022-0646 in github.com/aws/aws-sdk-go v1, which have no fix in v1. No github.com/docker/docker finding.
  • go build ./... and go vet ./libmachine/... pass. go test on every package except its/: the only failures are TestStorePathSetCorrectly and the drivers/vmwarefusion build on macOS, which fail the same way on main on that host. libmachine/mcndockerclient has no tests, and the swarm path is not covered by a test.

Part of https://gitlab.com/gitlab-org/gitlab-runner/-/work_items/40286

Edited by Lachlan Grant

Merge request reports

Loading
Loading