Permission denied when mounting Docker volume in OSX

后端 未结 2 1468
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-20 16:16

I\'m at my wit\'s end with this, so hopefully you folks can help me. In OSX 10.11.2 with docker-machine, I\'ve got a docker-compose file that should build a local Dockerfile

2条回答
  •  粉色の甜心
    2020-12-20 16:38

    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.

提交回复
热议问题