mirror of https://github.com/k3s-io/k3s
Create container log symlink for all containers
parent
7adb675003
commit
9da9e2ab59
|
@ -236,18 +236,21 @@ func (ds *dockerService) removeContainerLogSymlink(containerID string) error {
|
||||||
// StartContainer starts the container.
|
// StartContainer starts the container.
|
||||||
func (ds *dockerService) StartContainer(containerID string) error {
|
func (ds *dockerService) StartContainer(containerID string) error {
|
||||||
err := ds.client.StartContainer(containerID)
|
err := ds.client.StartContainer(containerID)
|
||||||
if err != nil {
|
|
||||||
err = transformStartContainerError(err)
|
// Create container log symlink for all containers (including failed ones).
|
||||||
return fmt.Errorf("failed to start container %q: %v", containerID, err)
|
if linkError := ds.createContainerLogSymlink(containerID); linkError != nil {
|
||||||
}
|
|
||||||
// Create container log symlink.
|
|
||||||
if err := ds.createContainerLogSymlink(containerID); err != nil {
|
|
||||||
// Do not stop the container if we failed to create symlink because:
|
// Do not stop the container if we failed to create symlink because:
|
||||||
// 1. This is not a critical failure.
|
// 1. This is not a critical failure.
|
||||||
// 2. We don't have enough information to properly stop container here.
|
// 2. We don't have enough information to properly stop container here.
|
||||||
// Kubelet will surface this error to user via an event.
|
// Kubelet will surface this error to user via an event.
|
||||||
return err
|
return linkError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
err = transformStartContainerError(err)
|
||||||
|
return fmt.Errorf("failed to start container %q: %v", containerID, err)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue