2017-08-18 23 views
0

在我的mac上,我在VMware中運行Windows Server 2016。在那裏,我在vagrant/Virtual Box中運行Ubuntu。在那裏,我試圖在nginx/uwsgi的docker容器中運行django應用程序。uwsgi在vmware中的流浪漢中的docker - 未創建套接字

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的文件夾設置爲共享爲大家寫權限。這是安裝在它是777的流浪VM中,並且在泊塢窗容器中也是777.我可以在所有3個位置的目錄中創建文件。但似乎uwsgi無法創建套接字。

我嘗試了短python腳本作爲測試的流浪漢,那不能創建一個socket之一:

[email protected]:/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:我在/ tmp中使用我的python腳本創建了套接字,chmod將其編輯爲777,並且仍然從uwsgi中獲得相同的錯誤。

+1

問題是'vagrant'與普通文件夾不同。如果執行命令'mount | grep vagrant'你會發現它使用'vboxfs'文件系統,並且它不會與docker –

+0

有什麼建議如何解決這個問題? –

+1

使用「/ vagrant」以外的其他文件夾。我通常使用'/ home/vagrant' –

回答

2

使用除/vagrant以外的其他文件夾。我通常使用/ home/vagrant

問題是/vagrant與普通文件夾不一樣。如果您執行命令mount | grep vagrant,您會發現它使用了vboxfs文件系統,該文件系統由於某些原因不能很好地與docker結合使用