Skip to content

Commit

Permalink
fix: pull docker image before running the container
Browse files Browse the repository at this point in the history
  • Loading branch information
artemijspavlovs committed Aug 18, 2024
1 parent bf45bd2 commit 816d122
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/utils/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/image"
"github.com/docker/docker/client"
"github.com/docker/go-connections/nat"
)
Expand Down Expand Up @@ -67,6 +68,12 @@ func CheckAndCreateMongoDBContainer(
}
}

pull, err := cli.ImagePull(ctx, imageName, image.PullOptions{})
if err != nil {
return err
}
defer pull.Close()

Check failure on line 75 in cmd/utils/docker.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `pull.Close` is not checked (errcheck)

resp, err := cli.ContainerCreate(ctx, config, hostConfig, nil, nil, containerName)
if err != nil {
return err
Expand Down

0 comments on commit 816d122

Please sign in to comment.