- Notifications
You must be signed in to change notification settings - Fork1.2k
Docker-compose timezone#1245
-
I have tried this docker-compose script above but still the timezone is default. |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 8 comments
-
TZ uses a specific format that's usually $docker run -d --rm -e TZ=Asia/Singapore --name postgres postgres40df8a60139036a6ba8bbaa94b5ec9f4acbdbd2c8c30dce828b5286fd565c7c5$dockerexec -it postgres psql -U postgrespsql (12.0 (Debian 12.0-2.pgdg100+1))Type "help" for help.postgres=# show timezone; TimeZone---------------- Asia/Singapore(1 row) |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I have changed it on
|
BetaWas this translation helpful?Give feedback.
All reactions
👍 3👀 1
-
Looks like you had an existing installation in your container, did you remove the previous container or just stop it? $docker-compose up -dCreating postgres ... done$docker-compose logs -fAttaching to postgrespostgres | The files belonging to this database system will be owned by user "postgres".postgres | This user must also own the server process.postgres |postgres | The database cluster will be initialized with locale "en_US.utf8".postgres | The default database encoding has accordingly been set to "UTF8".postgres | The default text search configuration will be set to "english".postgres |postgres | Data page checksums are disabled.postgres |postgres | fixing permissions on existing directory /var/lib/postgresql/data ... okpostgres | creating subdirectories ... okpostgres | selecting default max_connections ... 100postgres | selecting default shared_buffers ... 128MBpostgres | selecting default timezone ... Asia/Singaporepostgres | selecting dynamic shared memory implementation ... posixpostgres | creating configuration files ... okpostgres | running bootstrap script ... okpostgres | performing post-bootstrap initialization ... okpostgres | syncing data to disk ... okpostgres |postgres | Success. You can now start the database server using:postgres |postgres | pg_ctl -D /var/lib/postgresql/data -l logfile startpostgres |postgres |postgres | WARNING: enabling "trust" authentication for local connectionspostgres | You can change this by editing pg_hba.conf or using the option -A, orpostgres | --auth-local and --auth-host, the next time you run initdb.postgres | waiting for server to start....2019-11-27 01:08:20.431 +08 [43] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"postgres | 2019-11-27 01:08:20.700 +08 [44] LOG: database system was shut down at 2019-11-27 01:08:15 +08postgres | 2019-11-27 01:08:21.030 +08 [43] LOG: database system is ready to accept connectionspostgres | donepostgres | server startedpostgres | CREATE DATABASEpostgres |postgres |postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*postgres |postgres | 2019-11-27 01:08:26.130 +08 [43] LOG: received fast shutdown requestpostgres | waiting for server to shut down....2019-11-27 01:08:26.180 +08 [43] LOG: aborting any active transactionspostgres | 2019-11-27 01:08:26.185 +08 [43] LOG: background worker "logical replication launcher" (PID 50) exited with exit code 1postgres | 2019-11-27 01:08:26.186 +08 [45] LOG: shutting downpostgres | 2019-11-27 01:08:26.500 +08 [43] LOG: database system is shut downpostgres | donepostgres | server stoppedpostgres |postgres | PostgreSQL init process complete; ready for start up.postgres |postgres | 2019-11-27 01:08:26.610 +08 [1] LOG: listening on IPv4 address "0.0.0.0", port 5432postgres | 2019-11-27 01:08:26.610 +08 [1] LOG: listening on IPv6 address "::", port 5432postgres | 2019-11-27 01:08:26.702 +08 [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"postgres | 2019-11-27 01:08:26.876 +08 [61] LOG: database system was shut down at 2019-11-27 01:08:26 +08postgres | 2019-11-27 01:08:26.929 +08 [1] LOG: database system is ready to accept connections^CERROR: Aborting.$dockerexec -it postgres psql -U alonapsql (11.5 (Debian 11.5-3.pgdg90+1))Type "help" for help.alona=# show timezone; TimeZone---------------- Asia/Singapore(1 row) |
BetaWas this translation helpful?Give feedback.
All reactions
👍 2
-
yeah I did down and remove my previous container using
its really weird, still the timezone is ETC/UTC, anyway thank you, will try on other machines cause currently I'm on Ubuntu Linux |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Hello,@cheatmenot: |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
You need to set as environment variable in compose file like below TZ for the host and PGTZ for postress. for different time zone of PGTZ pls ref |
BetaWas this translation helpful?Give feedback.
All reactions
👍 11
-
Steps to change thetimezone in postgres docker image
|
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
It doesn't matter if the |
BetaWas this translation helpful?Give feedback.
All reactions
This discussion was converted from issue #641 on May 31, 2024 18:05.