Skip to content

Commit

Permalink
bump to docker v27.3.1+incompatible (#554)
Browse files Browse the repository at this point in the history
Co-authored-by: Ladislav Zvada <[email protected]>
Co-authored-by: David Shiflet <[email protected]>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent 708776a commit 58bc354
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/alecthomas/chroma/v2 v2.5.0
github.com/billgraziano/dpapi v0.4.0
github.com/docker/distribution v2.8.2+incompatible
github.com/docker/docker v25.0.6+incompatible
github.com/docker/docker v27.3.1+incompatible
github.com/docker/go-connections v0.4.0
github.com/golang-sql/sqlexp v0.1.0
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -57,6 +57,7 @@ require (
github.com/mattn/go-runewidth v0.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m3
github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg=
github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI=
github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8=
Expand Down Expand Up @@ -255,6 +257,8 @@ github.com/microsoft/go-mssqldb v1.8.0 h1:7cyZ/AT7ycDsEoWPIXibd+aVKFtteUNhDGf3ao
github.com/microsoft/go-mssqldb v1.8.0/go.mod h1:6znkekS3T2vp0waiMhen4GPU1BiAsrP+iXHcE7a7rFo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU=
github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
22 changes: 13 additions & 9 deletions internal/container/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/client"
"github.com/docker/docker/pkg/stdcopy"
"github.com/docker/go-connections/nat"
Expand All @@ -33,7 +34,10 @@ type Controller struct {
func NewController() (c *Controller) {
var err error
c = new(Controller)
c.cli, err = client.NewClientWithOpts(client.FromEnv)
c.cli, err = client.NewClientWithOpts(
client.FromEnv,
client.WithVersion("1.45"),
)
checkErr(err)

return
Expand All @@ -45,11 +49,11 @@ func NewController() (c *Controller) {
// if one occurred while creating the client. The Controller struct has a
// method EnsureImage() which pulls an image with the given name from
// a registry and logs the output to the console.
func (c Controller) EnsureImage(image string) (err error) {
func (c Controller) EnsureImage(imageName string) (err error) {
var reader io.ReadCloser

trace("Running ImagePull for image %s", image)
reader, err = c.cli.ImagePull(context.Background(), image, types.ImagePullOptions{})
trace("Running ImagePull for image %s", imageName)
reader, err = c.cli.ImagePull(context.Background(), imageName, image.PullOptions{})
if reader != nil {
defer func() {
checkErr(reader.Close())
Expand Down Expand Up @@ -106,7 +110,7 @@ func (c Controller) ContainerRun(
err = c.cli.ContainerStart(
context.Background(),
resp.ID,
types.ContainerStartOptions{},
container.StartOptions{},
)
if err != nil || unitTestFailure {
// Remove the container, because we haven't persisted to config yet, so
Expand All @@ -131,7 +135,7 @@ func (c Controller) ContainerRun(
// This function is useful for waiting until a specific event has occurred in the
// container (e.g. a server has started up) before continuing with other operations.
func (c Controller) ContainerWaitForLogEntry(id string, text string) {
options := types.ContainerLogsOptions{
options := container.LogsOptions{
ShowStdout: true,
ShowStderr: false,
Since: "",
Expand Down Expand Up @@ -177,7 +181,7 @@ func (c Controller) ContainerStart(id string) (err error) {
panic("Must pass in non-empty id")
}

err = c.cli.ContainerStart(context.Background(), id, types.ContainerStartOptions{})
err = c.cli.ContainerStart(context.Background(), id, container.StartOptions{})
return
}

Expand Down Expand Up @@ -329,7 +333,7 @@ func (c Controller) ContainerExists(id string) (exists bool) {
)
resp, err := c.cli.ContainerList(
context.Background(),
types.ContainerListOptions{Filters: f},
container.ListOptions{Filters: f},
)
checkErr(err)
if len(resp) > 0 {
Expand All @@ -352,7 +356,7 @@ func (c Controller) ContainerRemove(id string) (err error) {
panic("Must pass in non-empty id")
}

options := types.ContainerRemoveOptions{
options := container.RemoveOptions{
RemoveVolumes: false,
RemoveLinks: false,
Force: false,
Expand Down

0 comments on commit 58bc354

Please sign in to comment.