Skip to content

Commit f57dca7

Browse files
committed
fix: add loggerLogConfig
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 99acf7f commit f57dca7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pkg/inspecttypes/dockercompat/dockercompat.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ import (
4646
"github.com/containerd/nerdctl/v2/pkg/imgutil"
4747
"github.com/containerd/nerdctl/v2/pkg/inspecttypes/native"
4848
"github.com/containerd/nerdctl/v2/pkg/labels"
49-
"github.com/containerd/nerdctl/v2/pkg/logging"
5049
"github.com/containerd/nerdctl/v2/pkg/ocihook/state"
5150
)
5251

@@ -97,7 +96,14 @@ type ImageMetadata struct {
9796

9897
type LogConfig struct {
9998
Type string
100-
Config logging.LogConfig
99+
Config loggerLogConfig
100+
}
101+
102+
type loggerLogConfig struct {
103+
Driver string `json:"driver"`
104+
Opts map[string]string `json:"opts,omitempty"`
105+
LogURI string `json:"-"`
106+
Address string `json:"address"`
101107
}
102108

103109
// Container mimics a `docker container inspect` object.
@@ -307,7 +313,7 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
307313
// c.HostConfig.LogConfig.Config = map[string]string{}
308314
}
309315
if logConfigJSON, ok := n.Labels[labels.LogConfig]; ok {
310-
var logConfig logging.LogConfig
316+
var logConfig loggerLogConfig
311317
err := json.Unmarshal([]byte(logConfigJSON), &logConfig)
312318
if err != nil {
313319
return nil, fmt.Errorf("failed to unmarshal log config: %v", err)
@@ -317,7 +323,7 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
317323
c.HostConfig.LogConfig.Config = logConfig
318324
} else {
319325
// If LogConfig label is not present, set default values
320-
c.HostConfig.LogConfig.Config = logging.LogConfig{
326+
c.HostConfig.LogConfig.Config = loggerLogConfig{
321327
Driver: "json-file",
322328
Opts: make(map[string]string),
323329
}

0 commit comments

Comments
 (0)