Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/dind/dind.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func (c *Container) LoadImage(ctx context.Context, image string) (err error) {
if err != nil {
return fmt.Errorf("create temporary images file: %w", err)
}
// Close the file handle immediately: SaveImages and CopyFileToContainer
// open the file by name.
if err = imagesTar.Close(); err != nil {
return fmt.Errorf("close temporary images file: %w", err)
}
defer func() {
err = errors.Join(err, os.Remove(imagesTar.Name()))
}()
Expand Down
5 changes: 5 additions & 0 deletions modules/k3s/k3s.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ func (c *K3sContainer) LoadImagesWithOpts(ctx context.Context, images []string,
if err != nil {
return fmt.Errorf("creating temporary images file %w", err)
}
// Close the file handle immediately: SaveImages and CopyFileToContainer
// open the file by name.
if err = imagesTar.Close(); err != nil {
return fmt.Errorf("close temporary images file: %w", err)
}
defer func() {
_ = os.Remove(imagesTar.Name())
}()
Expand Down
Loading