diff --git a/internal/pkg/docker/dockerengine/dockerengine.go b/internal/pkg/docker/dockerengine/dockerengine.go index 7bc919a80fb..0ad7aa6fd6d 100644 --- a/internal/pkg/docker/dockerengine/dockerengine.go +++ b/internal/pkg/docker/dockerengine/dockerengine.go @@ -480,7 +480,7 @@ func (c DockerCmdClient) CheckDockerEngineRunning() error { return ErrDockerCommandNotFound } buf := &bytes.Buffer{} - err := c.runner.Run("docker", []string{"info", "-f", "json"}, exec.Stdout(buf)) + err := c.runner.Run("docker", []string{"info", "-f", "{{json .}}"}, exec.Stdout(buf)) if err != nil { return fmt.Errorf("get docker info: %w", err) } diff --git a/internal/pkg/docker/dockerengine/dockerengine_test.go b/internal/pkg/docker/dockerengine/dockerengine_test.go index b444ec3bdc6..10d6c342379 100644 --- a/internal/pkg/docker/dockerengine/dockerengine_test.go +++ b/internal/pkg/docker/dockerengine/dockerengine_test.go @@ -425,7 +425,7 @@ func TestDockerCommand_CheckDockerEngineRunning(t *testing.T) { "error running docker info": { setupMocks: func(controller *gomock.Controller) { mockCmd = NewMockCmd(controller) - mockCmd.EXPECT().Run("docker", []string{"info", "-f", "json"}, gomock.Any()).Return(mockError) + mockCmd.EXPECT().Run("docker", []string{"info", "-f", "{{json .}}"}, gomock.Any()).Return(mockError) }, wantedErr: fmt.Errorf("get docker info: some error"), @@ -433,7 +433,7 @@ func TestDockerCommand_CheckDockerEngineRunning(t *testing.T) { "return when docker engine is not started": { setupMocks: func(controller *gomock.Controller) { mockCmd = NewMockCmd(controller) - mockCmd.EXPECT().Run("docker", []string{"info", "-f", "json"}, gomock.Any()). + mockCmd.EXPECT().Run("docker", []string{"info", "-f", "{{json .}}"}, gomock.Any()). Do(func(_ string, _ []string, opt exec.CmdOption) { cmd := &osexec.Cmd{} opt(cmd) @@ -449,7 +449,7 @@ func TestDockerCommand_CheckDockerEngineRunning(t *testing.T) { "success": { setupMocks: func(controller *gomock.Controller) { mockCmd = NewMockCmd(controller) - mockCmd.EXPECT().Run("docker", []string{"info", "-f", "json"}, gomock.Any()). + mockCmd.EXPECT().Run("docker", []string{"info", "-f", "{{json .}}"}, gomock.Any()). Do(func(_ string, _ []string, opt exec.CmdOption) { cmd := &osexec.Cmd{} opt(cmd)