Docker mounted volume not tracking nginx log files

时间:2015-06-25 18:43:44

标签: linux nginx permissions docker

So I actually "solved" this issue right before posting this question, but I'll ask it anyway because I'd like to know why what I did works, I have nginx installed via brew and the docker nginx base image in my local machine. I have the directory /container/logs/nginx and I'm mounting it to /var/log/nginx that's inside of a docker container using docker run -d -P -v /container/logs/nginx:/var/log/nginx nginx I was expecting to see the access and error .log files in the mounted directory. However, nothing was there. I thought maybe, even though there were no error messages, that there might be a permissions issue with mapping from a directory that resides in my root directory, so I instead mapped it to /Users/jimmygong/containers/logs/nginx, using docker run -d -P -v /Users/jimmygong/container/logs/nginx:/var/log/nginx nginx This does work. Could someone walk me through exactly what's occurring here? Do I not have write permissions outside of my home directory (e.g. /Users/jimmygong)? I'm running Mac OS.

1 个答案:

答案 0 :(得分:1)

这是因为automount的{​​{1}}脚本 - 我假设您使用的是boot2docker,因为您使用boot2docker并且您的用户目录以{{1}开头}}。这也是您需要告诉virtualbox公开您的共享目录的事实。

想象一下如何分享您的音量:

brew

请参阅: