如何在Docker上更改postgreSQL 9.5的时区?

默认的时区是UTC。 但是我想把它改成GMT + 2。 我尝试如下。

alter database governance set timezone = 'GMT+2'; 

但它不起作用。

我如何pipe理它?

postgresql版本是9.5。 它运行在Docker上。

谢谢!

要改变你的图像的时区请试试这个:

 docker run -it -e "TZ=GMT+2" postgres:alpine 

泊坞窗,compose.yml

 postgres: image: postgres:alpine environment: - TZ=GMT+2 

您必须以这种格式在docker-compose.yml文件中指定时区:

 postgres: image: postgres:alpine environment: TZ: "Europe/Madrid"