Skip to content

Linking the 'vassals' folder #8

@bomb-on

Description

@bomb-on

I am trying to run uwsgi-docker within the container itself and expect it to mount/run vassal containers as intended. I'm using uWSGI 2.1 for the emperor (the container itself) and v2.0.12 for vassals. My Dockerfile for emperor container looks like this:

FROM ubuntu:14.04
RUN apt-get update
# essential software
RUN apt-get install -y python-dev  make  git libcurl4-openssl-dev libjansson-dev

# uWSGI v2.1-dev
RUN git clone https://github.com/unbit/uwsgi.git
RUN cd uwsgi && make && cp uwsgi /usr/bin/
RUN cd / && uwsgi --build-plugin https://github.com/unbit/uwsgi-docker
COPY /config/emperor.ini /

CMD uwsgi --ini /emperor.ini

Vassal container is made with the steps from this repository's Readme:

FROM ubuntu:14.04
RUN apt-get update
RUN apt-get install python libperl-dev build-essential libpcre3-dev cpanminus
RUN apt-get clean
RUN cpanm Plack
RUN curl http://uwsgi.it/install | bash -s psgi /usr/bin/uwsgi
RUN mkdir /var/www
RUN echo "my \$app = sub { return [200, [], ['Hello World from Docker']];}" > /var/www/app.pl

Paths in the emperor.ini file are set up accordingly, vassal's .ini file is the same as in the Readme example.

Problem
I have noticed that I have problem with linking the vassals folder. Trying to run my emperor container with a following command:

$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v /absolute/path/to/repository/uwsgi/vassals:/vassals --name=emperor emperor

results with this output (docker logs -f emperor):

[uWSGI] getting INI configuration from /emperor.ini
*** Starting uWSGI 2.1-dev-a1f68db (64bit) on [Tue Jan 12 10:12:02 2016] ***
compiled with version: 4.8.4 on 11 January 2016 15:50:47
os: Linux-4.2.0-23-generic #28-Ubuntu SMP Sun Dec 27 17:47:31 UTC 2015
nodename: b12ec6958ebd
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /
detected binary path: /usr/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 1048576
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
*** starting uWSGI Emperor ***
[docker] started fdf8a98ce642113bc7c7b0f0907b442b05c83f6282a7a72a16d7bdc60e966d77 (204)
[docker] waiting for proxy connection on container fdf8a98ce642113bc7c7b0f0907b442b05c83f6282a7a72a16d7bdc60e966d77 (psgi001.ini)

and it hangs here. Seems like the vassal container never responds as expected.

Also, the socket file is created in strange places and sometimes not even as a proper socket file:

# emperor container
$ docker exec emperor ls -al /vassals
total 12
drwxrwxr-x  2 2000 2000 4096 Jan 12 10:12 .
drwxr-xr-x 65 root root 4096 Jan 12 10:12 ..
-rw-rw-rw-  1 2000 2000 1068 Jan 12 10:08 psgi001.ini
srwxr-xr-x  1 root root    0 Jan 12 10:12 psgi001.ini.sock

# vassals container
$ docker exec psgi001.ini ls -al /
total 848
drwxr-xr-x  40 root root   4096 Jan 12 10:12 .
drwxr-xr-x  40 root root   4096 Jan 12 10:12 ..
-rwxr-xr-x   1 root root      0 Jan 12 10:12 .dockerenv
-rwxr-xr-x   1 root root      0 Jan 12 10:12 .dockerinit
...
drwxr-xr-x   2 root root   4096 Jan 12 10:12 psgi001.ini.sock

# my local machine
$ ls -al /absolute/path/to/repository/uwsgi/vassals
total 12
drwxrwxr-x 2 abc   abc   4096 jan 12 10:29 .
drwxrwxr-x 4 abc   abc   4096 jan 12 10:25 ..
-rw-rw-rw- 1 abc   abc   1078 jan 12 10:25 psgi001.ini
srwxr-xr-x 1 root root    0 jan 12 10:29 psgi001.ini.sock

Solution
However, if both paths for vassals folders are the same:

$ cp -r /absolute/path/to/repository/uwsgi/vassals /
$ docker run -d -v /var/run/docker.sock:/var/run/docker.sock -v /vassals:/vassals --name=emperor emperor

the emperor is able to communicate with vassal properly and everything runs as expected. Socket file is not created on my local machine or emperor, only in vassal and it is a socket file:

$ docker exec psgi001.ini ls -al /
total 848
drwxr-xr-x  40 root root   4096 Jan 12 10:32 .
drwxr-xr-x  40 root root   4096 Jan 12 10:32 ..
-rwxr-xr-x   1 root root      0 Jan 12 10:32 .dockerenv
-rwxr-xr-x   1 root root      0 Jan 12 10:32 .dockerinit
...
srwxr-xr-x   0 root root      0 Jan 12 10:32 psgi001.ini.sock

Why is this happening? Is this a bug or a intended functionality? I'd like to be able to link the folder directly from my repository to a different container's path, rather than copying it to root or handling the folders in vassals to match my /absolute/path/to/repository/uwsgi/vassals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions