StartContainer starts the container.
( _ context.Context, r *v1.StartContainerRequest, )
| 24 | |
| 25 | // StartContainer starts the container. |
| 26 | func (ds *dockerService) StartContainer( |
| 27 | _ context.Context, |
| 28 | r *v1.StartContainerRequest, |
| 29 | ) (*v1.StartContainerResponse, error) { |
| 30 | err := ds.client.StartContainer(r.ContainerId) |
| 31 | |
| 32 | // Create container log symlink for all containers (including failed ones). |
| 33 | if linkError := ds.createContainerLogSymlink(r.ContainerId); linkError != nil { |
| 34 | // Do not stop the container if we failed to create symlink because: |
| 35 | // 1. This is not a critical failure. |
| 36 | // 2. We don't have enough information to properly stop container here. |
| 37 | // Kubelet will surface this error to user via an event. |
| 38 | return nil, linkError |
| 39 | } |
| 40 | |
| 41 | if err != nil { |
| 42 | err = transformStartContainerError(err) |
| 43 | return nil, fmt.Errorf("failed to start container %q: %v", r.ContainerId, err) |
| 44 | } |
| 45 | |
| 46 | return &v1.StartContainerResponse{}, nil |
| 47 | } |
| 48 | |
| 49 | // transformStartContainerError does regex parsing on returned error |
| 50 | // for where container runtimes are giving less than ideal error messages. |
nothing calls this directly
no test coverage detected