mirror of
https://github.com/fosrl/docs-v2.git
synced 2026-02-08 05:56:45 +00:00
Add timezone configuration instructions for Docker containers
This commit is contained in:
42
self-host/advanced/timezone.mdx
Normal file
42
self-host/advanced/timezone.mdx
Normal file
@@ -0,0 +1,42 @@
|
||||
---
|
||||
title: "Container Timezone"
|
||||
description: "Configure the timezone for Pangolin, Gerbil, and Traefik containers to match your local time."
|
||||
---
|
||||
|
||||
By default, Docker containers report logs and timestamps in **UTC**. If you want the containers and their log output to use your local timezone, you need to set the timezone in both the container environment and mount the host timezone files.
|
||||
|
||||
## Updating your `docker-compose.yml`
|
||||
|
||||
Add the following to your `pangolin`, `gerbil`, and `traefik` services in `docker-compose.yml`:
|
||||
|
||||
```yaml title="docker-compose.yml"
|
||||
services:
|
||||
pangolin:
|
||||
environment:
|
||||
- TZ=America/New_York # Set your local timezone
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro # Sync host timezone
|
||||
- /etc/timezone:/etc/timezone:ro # Optional: some apps read this file
|
||||
|
||||
gerbil:
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
|
||||
traefik:
|
||||
environment:
|
||||
- TZ=America/New_York
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
```
|
||||
### Notes
|
||||
|
||||
- **Environment variable `TZ`** ensures most applications inside the container use the correct local timezone.
|
||||
- **`/etc/localtime` volume** ensures that system utilities (e.g., `date`) inside the container show the correct time.
|
||||
- **`/etc/timezone` volume** is optional, but some scripts and apps on Debian-based images read it to determine the timezone.
|
||||
- Logs generated by the containers (including Traefik and Gerbil) will now reflect your local time instead of UTC.
|
||||
|
||||
<Warning>
|
||||
Make sure that the host system has the correct timezone configured, as the containers will reference these host files.
|
||||
</Warning>
|
||||
Reference in New Issue
Block a user