summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2021-01-19 15:51:01 -0600
committerbaude <bbaude@redhat.com>2021-01-21 10:22:36 -0600
commit22d2caeeb1acadaced47bbacccec5f597e0d99f4 (patch)
tree9796716c648619a4eea9395ed03a23ce11cf3fde /cmd/podman
parent4ecd2be083ec973855e623bdc1290492e18672ac (diff)
downloadpodman-22d2caeeb1acadaced47bbacccec5f597e0d99f4.tar.gz
podman-22d2caeeb1acadaced47bbacccec5f597e0d99f4.tar.bz2
podman-22d2caeeb1acadaced47bbacccec5f597e0d99f4.zip
Set log driver for compatability containers
when using the compatibility api to create containers, now reflect the use of k8s-file as json-file so that clients, which are unaware of k8s-file, can work. specifically, if the container is using k8s-file as the log driver, we change the log type in container inspection to json-file. These terms are used interchangably in other locations in libpod/podman. this fixes log messages in compose as well. [NO TESTS NEEDED] Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/create.go2
-rw-r--r--cmd/podman/common/create_opts.go7
-rw-r--r--cmd/podman/common/specgen.go2
3 files changed, 9 insertions, 2 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 280175f95..17fba5427 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -402,7 +402,7 @@ func DefineCreateFlags(cmd *cobra.Command, cf *ContainerCLIOpts) {
logDriverFlagName := "log-driver"
createFlags.StringVar(
&cf.LogDriver,
- logDriverFlagName, "",
+ logDriverFlagName, logDriver(),
"Logging driver for the container",
)
_ = cmd.RegisterFlagCompletionFunc(logDriverFlagName, AutocompleteLogDriver)
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 9635f4135..f252618ce 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -517,3 +517,10 @@ func volumes() []string {
}
return nil
}
+
+func logDriver() string {
+ if !registry.IsRemote() {
+ return containerConfig.Containers.LogDriver
+ }
+ return ""
+}
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index 287836d9f..4cc53a630 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -463,7 +463,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
if s.LogConfiguration == nil {
s.LogConfiguration = &specgen.LogConfig{}
}
- s.LogConfiguration.Driver = define.KubernetesLogging
+
if ld := c.LogDriver; len(ld) > 0 {
s.LogConfiguration.Driver = ld
}