Larry Martell
Larry Martell

Reputation: 3756

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

On my mac I am running Windows Server 2016 in VMware. In there I am running Ubuntu in vagrant/Virtual Box. In there I am trying to run a django app in a docker container with nginx/uwsgi.

uwsgi is failing to start with:

[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] 

In VMware the folder is set for sharing for everyone with write permission. That is mounted in the vagrant VM where it is 777, and in the docker container is it also 777. I can create files in the dir from all 3 places. But it seems uwsgi cannot create the socket.

I tried a short python script as a test from vagrant and that could not create a socket either:

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

Anyone know how I can resolve this?

UPDATE: I changed the dir to /tmp where I can create a socket with my python script, but still uwsgi fails with the same error.

UPDATE 2: I created the socket in /tmp with my python script, chmod-ed it to 777 and still I get the same error from uwsgi.

Upvotes: 0

Views: 423

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146630

Use any other folder other than /vagrant. I usually use /home/vagrant

The problem is that /vagrant is not same as a normal folder. If you execute the command mount | grep vagrant you will find it uses a vboxfs file system, which for some reason doesn't gel well with docker

Upvotes: 2

Related Questions