Merge branch 'main' into main-v5

This commit is contained in:
iwilltry42 2021-08-18 14:13:10 +02:00
commit 95e0045418
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110
3 changed files with 33 additions and 14 deletions

View File

@ -121,6 +121,15 @@
"contributions": [
"doc"
]
},
{
"login": "Shanduur",
"name": "Mateusz Urbanek",
"avatar_url": "https://avatars.githubusercontent.com/u/32583062?v=4",
"profile": "http://shanduur.github.io",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,

View File

@ -9,7 +9,7 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/rancher/k3d?style=flat-square)](https://goreportcard.com/report/github.com/rancher/k3d)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-12-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
@ -139,6 +139,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center"><a href="http://wsl.dev"><img src="https://avatars2.githubusercontent.com/u/905874?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nuno do Carmo</b></sub></a><br /><a href="#content-nunix" title="Content">🖋</a> <a href="#tutorial-nunix" title="Tutorials"></a> <a href="#question-nunix" title="Answering Questions">💬</a></td>
<td align="center"><a href="https://github.com/erwinkersten"><img src="https://avatars0.githubusercontent.com/u/4391121?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Erwin Kersten</b></sub></a><br /><a href="https://github.com/rancher/k3d/commits?author=erwinkersten" title="Documentation">📖</a></td>
<td align="center"><a href="http://www.alexsears.com"><img src="https://avatars.githubusercontent.com/u/3712883?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex Sears</b></sub></a><br /><a href="https://github.com/rancher/k3d/commits?author=searsaw" title="Documentation">📖</a></td>
<td align="center"><a href="http://shanduur.github.io"><img src="https://avatars.githubusercontent.com/u/32583062?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mateusz Urbanek</b></sub></a><br /><a href="https://github.com/rancher/k3d/commits?author=Shanduur" title="Code">💻</a></td>
</tr>
</table>

View File

@ -192,22 +192,31 @@ func executeCheckInContainer(ctx context.Context, image string, cmd []string) (i
}
defer docker.Close()
if err = pullImage(ctx, docker, image); err != nil {
return -1, err
}
resp, err := docker.ContainerCreate(ctx, &container.Config{
Image: image,
Cmd: cmd,
Tty: false,
Entrypoint: []string{},
}, nil, nil, nil, "")
if err != nil {
l.Log().Errorf("Failed to create container from image %s with cmd %s", image, cmd)
return -1, err
// create container
var resp container.ContainerCreateCreatedBody
for {
resp, err = docker.ContainerCreate(ctx, &container.Config{
Image: image,
Cmd: cmd,
Tty: false,
Entrypoint: []string{},
}, nil, nil, nil, "")
if err != nil {
if client.IsErrNotFound(err) {
if err := pullImage(ctx, docker, image); err != nil {
l.Log().Errorf("Failed to create container from image %s with cmd %s", image, cmd)
return -1, err
}
continue
}
l.Log().Errorf("Failed to create container from image %s with cmd %s", image, cmd)
return -1, err
}
break
}
if err = startContainer(ctx, resp.ID); err != nil {
l.Log().Errorf("Failed to start container from image %s with cmd %s", image, cmd)
return -1, err
}