docker 中的 uwsgi in vmware 中的 vagrant - 未创建套接字

uwsgi in docker in vagrant in vmware - socket not being created

在我的 mac 上,我正在 运行ning Windows VMware 中的 Server 2016。我在 运行ning Ubuntu in vagrant/Virtual Box 里。在那里,我试图 运行 一个带有 nginx/uwsgi 的 docker 容器中的 django 应用程序。

uwsgi 无法启动:

[uWSGI] getting INI configuration from /opt/django/CAPgraph/uwsgi.ini
*** Starting uWSGI 2.0.15 (64bit) on [Thu Aug 17 20:01:23 2017] ***
compiled with version: 6.4.0 20170805 on 17 August 2017 06:10:50
os: Linux-3.13.0-128-generic #177-Ubuntu SMP Tue Aug 8 11:40:23 UTC 2017
nodename: 37db4344b5ae
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /opt/django/CAPgraph/
your memory page size is 4096 bytes
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
bind(): Operation not permitted [core/socket.c line 230] 

在 VMware 中,该文件夹设置为共享给所有具有写权限的人。它安装在 vagrant VM 中,它是 777,在 docker 容器中它也是 777。我可以从所有 3 个地方在目录中创建文件。但似乎 uwsgi 无法创建套接字。

我尝试了一个简短的 python 脚本作为 vagrant 的测试,但它也无法创建套接字:

vagrant@vagrant-ubuntu-trusty-64:/vagrant$ python -c "import socket as s; sock = s.socket(s.AF_UNIX); sock.bind('/vagrant/app.sock')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 1] Operation not permitted

有人知道我该如何解决这个问题吗?

更新:我将目录更改为 /tmp,在那里我可以使用我的 python 脚本创建套接字,但 uwsgi 仍然失败并出现相同的错误。

更新 2:我用我的 python 脚本在 /tmp 中创建了套接字,将它修改为 777,但我仍然从 uwsgi 得到同样的错误。

使用 /vagrant 以外的任何其他文件夹。我通常使用 /home/vagrant

问题是 /vagrant 与普通文件夹不同。如果你执行命令 mount | grep vagrant 你会发现它使用 vboxfs 文件系统,由于某些原因它不能很好地与 docker

融合