From 7425056ba0f3c227be3ea1b0442200ba25a8a960 Mon Sep 17 00:00:00 2001 From: Ganesh Hegde Date: Thu, 2 Jan 2020 09:31:27 +0100 Subject: [PATCH] [./dev_docker] fix TZ issue for docker on mac (#261) When TZ is not explicitly specified, docker on mac throws up this nice error by default: ``` docker: Error response from daemon: Mounts denied: The path /etc/localtime is not shared from OS X and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> File Sharing. See https://docs.docker.com/docker-for-mac/osxfs/#namespaces for more info. ``` Refer this upstream docker for-mac upstream issue for details: https://github.com/docker/for-mac/issues/2396 This tiny improvement makes onboarding easier for mac folks who don't want to install libcoap maybe? --- script/dev_docker | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/dev_docker b/script/dev_docker index 5aab4bb4..0793bf7a 100755 --- a/script/dev_docker +++ b/script/dev_docker @@ -28,6 +28,15 @@ then -v `pwd`:/usr/src/app \ --rm \ -t -i tradfri-dev bash +elif [ "$(uname)" = "Darwin" ] && [ $# -eq 0 ] +then + OSX_TZ=$(ls -la /etc/localtime | cut -d/ -f8-9) + docker run \ + --net=host \ + -e "TZ=$OSX_TZ" \ + -v `pwd`:/usr/src/app \ + --rm \ + -t -i tradfri-dev bash else docker run \ --net=host \