I’m going to assume you have SSH and/or ftp access to modify the ‘compose.yaml’ file that you intend to modify.
All we need to do is add the ‘TZ’ variable to the environment section with your timezone name that you can get from Wikipedia here, like so.
services:
service_name:
environment:
- TZ=America/EdmontonYAMLPortainer
All you have to do for portainer is create a new environment variable called TZ with the value of your timezone, like so:

Click Deploy just above the advanced section, then your container will be recreated with the new environment variable!
Compose More Detailed Version
Let’s edit the compose file:
nano compose.yamlBashor…
sudo nano compose.yamlBashDepending on what your permission for your file is.
Edit your compose file:

Go to the Wikipedia page here and look up your Timezone in the table.


Copy/Paste the ‘TZ Identifier’ and add it to your Docker Compose file like so. If you don’t have the ‘environment’ section, you can copy and paste this.
environment:
- TZ=YAMLMake sure you have 4 spaces from the start of the line and 2 spaces from the start of the ‘environment’ section on the next line for the ‘- TZ=’ section(6 from the beginning of the line). YAML is space-sensitive, so it will fail to compile if the spaces are wrong.
You should validate the file to make sure you don’t get any errors. All you need to do is type.
sudo docker compose -f compose.yaml configBashIn this command, we use ‘sudo docker compose -f’, which, in this case, the ‘-f’ tells Docker Compose that we are dealing with Compose configuration files. ‘compose.yaml’ is the name of the compose file in my case. Replace it with the name of your file. Finally, ‘config’ is the command that tells it that we will parse, resolve and render the compose file.

You should get the output of the file if it validated correctly:

Now you can bring the container up with:
Replace the ‘compose.yaml’ with your file name.
sudo docker compose -f compose.yaml up -dBash