I’m having trouble getting a very simple image to run. It’s a Twisted server. Here’s the Dockerfile:
FROM python:2.7
RUN pip install --upgrade pip
RUN easy_install pyapns
RUN pip install service_identity
RUN pip install python-epoll
EXPOSE 7077
CMD ["twistd", "-r", "epoll", "web", "--class=pyapns.server.APNSServer", "--port=7077"]
ENTRYPOINT ["/bin/sh", "-c"]
When I run it, the output is the twisted usage info, as if I had not specified the class to run, etc.
If I comment out the CMD statement and set the ENTRYPOINT to bash, if I enter the following line, it runs fine. (Note: I added the -n option simply so I can see the output. I’ve tried the above with it and it doesn’t change anything)
The solution was to simply remove the ENTRYPOINT instruction. I had thought that ENTRYPOINT ["/bin/sh", "-c"] was equivalent to the default, but I guess not.
I had specified that because I had noticed that when doing docker run -i -t python:2.7, I started in a python interpreter, so so I thought (mistakenly) that I needed to override ENTRYPOINT. I hadn’t looked at the Dockerfile for that image, and had I done so I would have seen that python2 was the CMD.