Permission denied when mounting Docker volume in OSX

谁都会走 提交于 2019-11-29 13:36:19

The issue this comes from is the userids used by Mac and Linux respectively. Mac does not like Linux wanting to use the 1 for the userID.

The way I worked around all the permissions craziness in my mac + docker-machine setup is to use this Dockerfile

FROM mysql:5.6

RUN usermod -u 1000 mysql
RUN mkdir -p /var/run/mysqld
RUN chmod -R 777 /var/run/mysqld

Instead of the plain MySQL 5.6 Image.

The last 2 lines are necessary, because changing the userid for the mysql user will mess up the build in permissions for that image. => you need the 777 permissions to make it run here :/

I know this is a little hacky, but so far the best solution I know to the permissions issue here.

Try to use the latest docker for mac instead of docker tools. Docker for Mac no longer uses VirtualBox, but rather HyperKit, a lightweight OS X virtualization solution built on top of Hypervisor.framework in OS X 10.10 Yosemite and higher.

I suggest also completely remove docker tools(they could co-exist): https://github.com/docker/toolbox/blob/master/osx/uninstall.sh

With docker for mac, you don't have to use permission hacks, it would just work like it would be on a linux build.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!