From 9a1543caec75a7b02dd2ec9a1111756bb1716454 Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Tue, 30 Jun 2020 17:21:52 -0400 Subject: Add --tz flag to create, run --tz flag sets timezone inside container Can be set to IANA timezone as well as `local` to match host machine Signed-off-by: Ashley Cui --- cmd/podman/common/create.go | 5 +++++ cmd/podman/common/create_opts.go | 1 + cmd/podman/common/specgen.go | 1 + 3 files changed, 7 insertions(+) (limited to 'cmd') diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go index ec3251ae1..0534fd582 100644 --- a/cmd/podman/common/create.go +++ b/cmd/podman/common/create.go @@ -449,6 +449,11 @@ func GetCreateFlags(cf *ContainerCLIOpts) *pflag.FlagSet { "tty", "t", false, "Allocate a pseudo-TTY for container", ) + createFlags.StringVar( + &cf.Timezone, + "tz", containerConfig.TZ(), + "Set timezone in container", + ) createFlags.StringSliceVar( &cf.UIDMap, "uidmap", []string{}, diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 4f3b8b322..6f45e24e9 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -91,6 +91,7 @@ type ContainerCLIOpts struct { Systemd string TmpFS []string TTY bool + Timezone string UIDMap []string Ulimit []string User string diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index 1f6fbbe98..273fcc589 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -619,6 +619,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string } s.Remove = c.Rm s.StopTimeout = &c.StopTimeout + s.Timezone = c.Timezone return nil } -- cgit v1.2.3-54-g00ecf