(name string, containerConfig *container.Config, hostConfig *container.HostConfig, form *tview.Form)
| 98 | } |
| 99 | |
| 100 | func createContainer(name string, containerConfig *container.Config, hostConfig *container.HostConfig, form *tview.Form) error { |
| 101 | client, err := getDockerClient() |
| 102 | if err != nil { |
| 103 | return err |
| 104 | } |
| 105 | |
| 106 | logView := form.GetFormItemByLabel("").(*tview.TextView) |
| 107 | |
| 108 | if err := pullImageBlocking(containerConfig.Image, logView); err != nil { |
| 109 | return err |
| 110 | } |
| 111 | |
| 112 | out, err := client.ContainerCreate(context.Background(), containerConfig, hostConfig, nil, nil, name) |
| 113 | if err != nil { |
| 114 | return err |
| 115 | } |
| 116 | for _, warning := range out.Warnings { |
| 117 | logView.Write([]byte(warning + "\n")) |
| 118 | logView.ScrollToEnd() |
| 119 | } |
| 120 | return client.ContainerStart(context.Background(), out.ID, container.StartOptions{}) |
| 121 | } |
no test coverage detected