Commit 37273693 authored by Random-Liu's avatar Random-Liu

Fix bug in dockershim to set sandbox id properly.

parent 56be1976
...@@ -56,8 +56,10 @@ func toRuntimeAPIContainer(c *dockertypes.Container) (*runtimeApi.Container, err ...@@ -56,8 +56,10 @@ func toRuntimeAPIContainer(c *dockertypes.Container) (*runtimeApi.Container, err
return nil, err return nil, err
} }
labels, annotations := extractLabels(c.Labels) labels, annotations := extractLabels(c.Labels)
sandboxID := c.Labels[sandboxIDLabelKey]
return &runtimeApi.Container{ return &runtimeApi.Container{
Id: &c.ID, Id: &c.ID,
PodSandboxId: &sandboxID,
Metadata: metadata, Metadata: metadata,
Image: &runtimeApi.ImageSpec{Image: &c.Image}, Image: &runtimeApi.ImageSpec{Image: &c.Image},
ImageRef: &c.ImageID, ImageRef: &c.ImageID,
......
...@@ -75,6 +75,7 @@ func TestListContainers(t *testing.T) { ...@@ -75,6 +75,7 @@ func TestListContainers(t *testing.T) {
expected = append([]*runtimeApi.Container{{ expected = append([]*runtimeApi.Container{{
Metadata: configs[i].Metadata, Metadata: configs[i].Metadata,
Id: &id, Id: &id,
PodSandboxId: &sandboxID,
State: &state, State: &state,
Image: configs[i].Image, Image: configs[i].Image,
ImageRef: &imageRef, ImageRef: &imageRef,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment