Problem investigation that JST is converted to +0000 +0000 when golang timezone conversion is performed on Alpine docker image

Introduction

I've pulled a bit of a maniac bug, so can this contribute to OSS? I think, I will summarize the survey record

Event

--In the process of converting the time of golang running on the docker image of alpine, the time that should be converted in the JST time zone like 2020-11-08 00:04:05 +0900 JST is 2020 -11-07 15:04:05 +0000 + 0000 --golang: build with 1.12.4 --alpine: latest (as of the end of October 2020) → 3.20? --tzdata: latest (as of the end of October 2020) → tzdata2020d-r0?

Other facts include:

--It was working until mid-October --It works fine if you replace zoneinfo --Alpine tzdata was updated just on October 25th (alpine tzdata, [commit](https: //) From git.alpinelinux.org/aports/commit/?id=fbc0b7dac48b9df9d3b9a04e514b6445b75f2e52))

Verification

Since tzdata2020d could not be used at the time of verification, it was verified with tzdata2020c-r0, but the conclusion is as follows.

-** I got the result that JST conversion is not possible when using alpine && tzdata2020c-r0 and tzdata2020d-r0 with the binary built with golang1.12 **.

Use the research repository (alpine_tzdata_investigation) and use Docker to check the combination of several versions. , Notes describes how to check.)

go version docker image tzdata result note
go 1.12 alpine 3.12.1 tzdata 2020c-r0 failure version isdockerhubandalpinepackageConfirm with
go 1.12 alpine 3.10.3 tzdata 2020c-r0 failure
go 1.12 alpine edge tzdata 2020d-r0 failure
go 1.12 alpine 3.8 tzdata 2020a-r0 success Because only alpine 8 was using 2020a
golang 1.12 ubuntu 20.04 tzdata 2020d-0ubuntu0.20.04 success version isdockerhubandUbuntupackagesConfirm with
golang 1.15.4(alpine) alpha 3.12.1 tzdata 2020c-r0 success golang version is[golang dockerhub]Confirm with
golang 1.13 alpine 3.12.1 tzdata 2020c-r0 success

result, --go 1.12 but ubuntu and alpine && tzdata2020a will pass --alpine && tzdata2020c-r0, tzdata2020d-r0 will pass if golang 1.13 or later

I understand this.

Coping

  1. Change the version of go or alpine
  2. If you really don't want to change both, replace tzdata (sample)

Recommended Posts

Problem investigation that JST is converted to +0000 +0000 when golang timezone conversion is performed on Alpine docker image
How to solve the problem that the website image is not displayed after deploying to heroku on Rails 5
[Rails] How to solve the problem that the default image is overwritten when editing without uploading the image [Active Storage]
[Docker] How to build when the source code is bind-mounted on the container