Search code examples
dockerpython-3.6pyramid

Error while building a Pyramid app in a Docker container


I´m trying to build a pyramid docker container with the code from a repository. I´m new to docker but i´ve tried this in my dockerfile

FROM alpine:3.7

RUN apk add --update\
    python3 \
    py-pip \
    git

RUN pip3 install --upgrade pip
RUN git clone http://my_git_repo test && \
    cd test && \
    pip3 install -e . && \
    initialize_untitled2_db development.ini && \
    pserve development.ini

EXPOSE 6543`

everything the container run all commands and everything works but on the last command he fails to start the pyramid app.

then i get following error message:

    Traceback (most recent call last):
  File "/usr/bin/pserve", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 32, in main
    return command.run()
  File "/usr/lib/python3.6/site-packages/pyramid/scripts/pserve.py", line 239, in run
    server(app)
  File "/usr/lib/python3.6/site-packages/paste/deploy/loadwsgi.py", line 189, in server_wrapper
    **context.local_conf)
  File "/usr/lib/python3.6/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/python3.6/site-packages/waitress/__init__.py", line 20, in serve_paste
    serve(app, **kw)
  File "/usr/lib/python3.6/site-packages/waitress/__init__.py", line 11, in serve
    server = _server(app, **kw)
  File "/usr/lib/python3.6/site-packages/waitress/server.py", line 85, in create_server
    sockinfo=sockinfo)
  File "/usr/lib/python3.6/site-packages/waitress/server.py", line 182, in __init__
    self.bind_server_socket()
  File "/usr/lib/python3.6/site-packages/waitress/server.py", line 294, in bind_server_socket
    self.bind(sockaddr)
  File "/usr/lib/python3.6/asyncore.py", line 329, in bind
    return self.socket.bind(addr)
OSError: [Errno 99] Address not available

The pyramid app works without problem outside a Container. Like i said im new into docker and i cant find the mistake.

The config file for the application runs on the localhost and with port mapping it shouldnt be a problem to run on the localhost of docker too.

Does someone know whats causing this error ?


Solution

  • It seemd to be a problem with "localhost" domain name in the config. I changed it to the local IP-Adress "127.0.0.1" then it worked fine.