Skip to content

Conversation

@K2ouMais
Copy link

@K2ouMais K2ouMais commented Nov 27, 2025

Description:

It has been possible to set container timezones via the TZ environment variable without installing tzdata. To improve visibility and usability, I have explicitly added this ENV variable to all Dockerfiles and updated the documentation.

FrankenPHP & Caddy Logging:

Currently, the FrankenPHP images (using Caddy) output logs in UTC by default, which can complicate debugging. I have adjusted the Caddy configuration to:

  1. Respect the timezone set via the TZ variable in log outputs.
  2. Introduce a new variable, CADDY_LOG_DATETIME_FORMAT, allowing for custom timestamp formats supported by Caddy.

Backward Compatibility:

These changes are fully backward compatible. Default values are in place, ensuring that if TZ or CADDY_LOG_DATETIME_FORMAT are not set, the behavior remains exactly as it is now.

Examples

docker-compose.yml

services:
  app:
    image: serversideup/php:8.5-frankenphp
    environment:
      TZ: Europe/Berlin
      CADDY_LOG_DATETIME_FORMAT: "wall"
...

Running directly in your terminal:

docker run --rm -it \
  -e TZ=Europe/Berlin \
  -e CADDY_LOG_DATETIME_FORMAT=wall \
  serversideup/php:8.5-frankenphp

@K2ouMais
Copy link
Author

K2ouMais commented Nov 28, 2025

Please take a look at the following file:

https://github.com/serversideup/docker-php/blob/main/src/variations/frankenphp/etc/frankenphp/log-level/global/debug.caddyfile#L1C1-L1C6

There is on line one the word "debug". I just let it the way it was and didnt find any reference in the caddy logs for that.
It could be a possible bug?

@jaydrogers
Copy link
Member

Whoops, I should have commented here 😃

Thanks for opening a PR! I will review for the next release.

Sorry for the delay. I was working on serversideup/php today but I had another bug take many hours longer than expected 🙃

I'll circle back and take a look at this soon.

@K2ouMais
Copy link
Author

K2ouMais commented Dec 8, 2025

@jaydrogers I made a mistake on this one.

I declared TZ to be available on all images, but that is not true 🤦‍♂️

You can use TZ only on debian based images. On alpine images, tzdata would have to be installed.

Let me know, how should I progress on this one.

@K2ouMais
Copy link
Author

K2ouMais commented Dec 10, 2025

I reverted recent changes to Dockerfiles that attempted to set the timezone via the TZ environment variable.

Reason for Revert

The TZ environment variable relies on the presence of timezone data, which is not included in Alpine based images. Consequently, this configuration does not work on images built on Alpine.

Impact & New Standard

Alpine Images:

  • Alpine-based images will continue to default to the UTC timezone.

  • Changing the timezone on these images now explicitly requires installing the tzdata package (the standard Alpine method).

  • This typically requires building your own custom image based on the serversideup image and including the tzdata installation step.

  • Caddy logs within these Alpine images will still use UTC timestamps.

Debian Images:

  • The TZ environment variable remains functional for changing the timezone on Debian-based images (which have been the default for some time). This behavior is now explicitly documented.

New Feature for Log Clarity

To improve log readability, especially for users remaining on UTC, we have introduced a new environment variable:

CADDY_LOG_DATETIME_FORMAT: Allows users to customize the timestamp format of the Caddy access logs, providing better clarity and integration with external logging tools.

@jaydrogers
Copy link
Member

How much space gets added to Alpine if we include tzdata by default?

@K2ouMais
Copy link
Author

To be honest I didnt try, because you said you didnt want any packages installed, that would possibly make the images bigger, wich is understandable.

@jaydrogers
Copy link
Member

No problem. I can take a look if needed. I appreciate your efforts on this 👍

@K2ouMais
Copy link
Author

Please also take a look at this file:

https://github.com/serversideup/docker-php/blob/main/src/variations/frankenphp/etc/frankenphp/log-level/global/debug.caddyfile#L1C1-L1C6

On the first line there is the word debug wich isnt in any other files and I couldnt find anything on the caddy documentation about it. It might be a typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants