After Docker upgrade - results in "The path /etc/localtime is not shared from OS X and is not known to Docker"
Expected behavior
Docker upgrade shouldn't affect already working mount mappings.
Actual behavior
Upgrade to new version of docker on Mac OSX now results in "The path /etc/localtime is not shared from OS X and is not known to Docker".
Information
- Full output of the diagnostics from "Diagnose & Feedback" in the menu
Docker for Mac: version: 17.12.0-ce-mac46 (a61e84b8bca06b1ae6ce058cdd7beab1520ad622) macOS: version 10.12.6 (build: 16G1114) logs: /tmp/072847D3-A6CD-4D63-BC1A-BE8199F81553/20180110-104443.tar.gz [OK] db.git [OK] vmnetd [OK] dns [OK] driver.amd64-linux [OK] virtualization VT-X [OK] app [OK] moby [OK] system [OK] moby-syslog [OK] kubernetes [OK] env [OK] virtualization kern.hv_support [OK] slirp [OK] osxfs [OK] moby-console [OK] logs [OK] docker-cli [OK] menubar [OK] disk
- A reproducible case if this is a bug, Dockerfiles FTW
- Page URL if this is a docs issue or the name of a man page
Steps to reproduce the behavior
1.On previous version, Existing docker run command executed successfully as:
docker run -d -p 80 \
--name ${CONTAINER_NAME} \
--restart=always \
-v /etc/localtime:/etc/localtime:ro \
-v ${ENV_APPDIR}/app:/usr/share/app:ro \
-l agent-host=${agent_host} \
${CONTAINER_NAME}
- Upgrade to new Docker release
- Same docker run command now fails with
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.
Having the same problem
I am also having same problem
Same on me
Facing same issue. Downgraded docker to Version 17.09.1-ce-mac42 to proceed for now.
Same on me
I also have the same issue. Downgrading if i can figure out how
If you go to Preferences/File Sharing, is /etc in the list, and does adding it again fix the issue?
@justincormack No /etc is not in the list and it's not possible to add it there with message:
The path /etc is reserved by Docker however it may be possible to export specific subdirectories.
Having the same issue,
Ah ok, it looks like the host does not have an /etc/localtime file. If it did, it would only have UTC in, you are probably better off adding that to your container or omitting it.
What exactly are you trying to achieve by bind mounting it? Which local time are you interested in?
On my machine:
$ ls -la /etc/localtime
lrwxr-xr-x 1 root wheel 36 Aug 24 13:17 /etc/localtime -> /usr/share/zoneinfo/America/New_York
I think this technique is a popular solution to configure a container's timezone.
I have this same issue, with
- Version 17.12.0-ce-mac47 (21805)
- Version 17.12.0-ce-mac46 (didn't record build#)
Specifically on OSX, /etc is actually a symlink to /private/etc.
I know that /etc cannot be added as a shared directory. Presumably, because it'll be overlaid on the Moby VM at /etc which will kill the actual VM that serves our Docker daemon (this was always my understanding).
By happy coincidence, though, that /private/etc symlink would be resolved by the Docker-for-Mac system and since /private is a shared directory, it would work.
Could this be a regression in docker / Docker-for-Mac's handling of symlinks in bind-mounts?
For now, I work around the issue by re-installing an older version: Docker-for-Mac 17.09.1-ce-mac42 (21090)
If you do add /etc/localtime to the Docker for Mac Preferences/File Sharing, then you get a different error which seems to show that on Version 17.12.0-ce-mac45 it is actually trying to mkdir the directory on the MacOS side. As an aside this works perfectly in Ubuntu 16.04 with the latest docker, so it looks like a regression:
docker run -it -v /etc/localtime:/etc/localtime:ro hello-world
docker: Error response from daemon: error while creating mount source path '/etc/localtime': mkdir /etc/localtime: file exists.
Same issue: here's my OSX-specific workaround.
- Make sure you have the tzdata package installed in the container
- Add
-e TZ=`ls -la /etc/localtime | cut -d/ -f8-9`to thedocker runcommand line
Ah nice trick. Smart to use an env variable instead. Hopefully they
Thanks, Rich
Sent from my iPhone X http://tongfamily.com | @richtong | https://fb.me/richtong1
On Jan 16, 2018, at 16:12, Giel [email protected] wrote:
Same issue: here's my OSX-specific workaround.
Make sure you have the tzdata package installed in the container Add -e TZ=
ls -la /etc/localtime | cut -d/ -f8-9to the docker run command line — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
I have the same issue, and I need to make it work with docker-compose. Any suggestions?
Solved ... specified TZ in the .env file for docker-compose. Not sure if it works, but at least I could start it up ...
Tried setting TZ in .env file and still docker-compose fails to start.
$ echo "TZ=$(ls -la /etc/localtime | cut -d/ -f8-9)" >> .env
$ docker-compose up -d
...
Starting blockbox_cinder-volume_1 ... error
ERROR: for blockbox_cinder-volume_1 Cannot start service cinder-volume: 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.
.
We are also affected by this change. Please fix it.
Any update on this bug? Will we have a fix soon?