I’m running docker desktop(WSL2 based engine) on my windows 11 machine to run a couple of .NET api’s in containers.
What Im having issue is even though my windows’ timezone is set to UTC + 3, neither the WSL docker-desktop distro im running nor the container’s timezone is using same setting. They are by default set to UTC + 0.
I may be misunderstanding something but AFAIK the volume Im setting below in docker-compose for localtime works in a way so that it copies /etc/localtime from HOST to container directory. What Im getting confused here is, the “HOST” here is my case is whether the WSL docker-desktop distro or the windows itself.
My default distro is set to docker-desktop and when I run the WSL date command in terminal I get UTC + 0 result. When I try to check if /etc/localtime exists in docker-desktop distro instance I get below error saying it doesnt exists:
cat: can’t open ‘/etc/localtime’: No such file or directory
Here are the outputs of dates both in wsl and in windows:
wsl date
Fri Apr 26 10:45:19 UTC 2024
date
Friday, April 26, 2024 1:45:21 PM
Also please note that the same config/setup works for my colleage using an intel mac having the same UTC + 3 timezone.
docker-compose.override.yml sample:
some-api:
container_name: some-api
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://+:80
- identityUrl=http://some-api
- RABBITMQ_CONNECTION_STRING=${RABBITMQ_CONNECTION_STRING}
- SQLSERVER_NAME_OR_IP=${SQLSERVER_NAME_OR_IP},1433
- MONGO_SERVER_NAME_OR_IP=${MONGO_SERVER_NAME_OR_IP}
depends_on:
- elasticsearch
ports:
- '32817:80'
volumes:
- ./certificates/dev:/https:ro
- /etc/localtime:/etc/localtime:ro
Please help me understand the problem, thanks in advance.