diff --git a/README.md b/README.md index 3f7c9751..9a06e44b 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant. - [Prepare LaraDock for Production](#LaraDock-for-Production) - [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean) - [Misc](#Misc) + - [Change the timezone](#Change-the-timezone) - [Cron jobs](#CronJobs) - [MySQL access from host](#MySQL-access-from-host) - [Use custom Domain](#Use-custom-Domain) @@ -985,6 +986,24 @@ To learn more about how Docker publishes ports, please read [this excellent post
+ +### Change the timezone + +To change the timezone for the `workspace` container, modify the `TZ` build argument in the Docker Compose file to one in the [TZ database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + +For example, if I want the timezone to be `New York`: + +```yml + workspace: + build: + context: ./workspace + args: + - TZ=America/New_York + ... +``` + +We also recommend [setting the timezone in Laravel](http://www.camroncade.com/managing-timezones-with-laravel/). + ### Adding cron jobs @@ -997,6 +1016,8 @@ You can add your cron jobs to `workspace/crontab/root` after the `php artisan` l * * * * * root echo "Every Minute" > /var/log/cron.log 2>&1 ``` +Make sure you [change the timezone](#Change-the-timezone) if you don't want to use the default (UTC). + ### MySQL access from host diff --git a/docker-compose.yml b/docker-compose.yml index f9c86327..35b901ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,6 +18,7 @@ services: - PUID=1000 - PGID=1000 - NODE_VERSION=stable + - TZ=UTC volumes_from: - volumes_source extra_hosts: diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 0296fa97..24365859 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -46,6 +46,14 @@ ARG PUID=1000 ARG PGID=1000 RUN groupadd -g $PGID laradock && \ useradd -u $PUID -g laradock -m laradock + +##################################### +# Set Timezone +##################################### + +ARG TZ=UTC +ENV TZ ${TZ} +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ##################################### # Composer: