Open shynome opened 6 years ago
上次使用 Docker 运行项目的时候出了一个时区问题, 但也不可能每个容器都改一遍呀, 于是只能放弃在 docker-compose.yml 文件里做文章, 而是在代码程序里做了修改, 不过今天偶然发现了解决方案, 把宿主机的时区配置通过 volumes 挂载进去就好了
docker-compose.yml
volumes
services: nginx: image: nginx volumes: - '/etc/timezone:/etc/timezone:ro' - '/etc/localtime:/etc/localtime:ro'
上次使用 Docker 运行项目的时候出了一个时区问题, 但也不可能每个容器都改一遍呀, 于是只能放弃在
docker-compose.yml
文件里做文章, 而是在代码程序里做了修改, 不过今天偶然发现了解决方案, 把宿主机的时区配置通过volumes
挂载进去就好了