I want to run Python HTTP server on docker container.
My DockerFile
looks like this:
FROM continuumio/anaconda3:latest
RUN apt-get -y update
RUN apt-get -y install linux-headers-amd64 build-essential libc-dev gcc
RUN conda install --yes gcc
RUN conda install --yes numpy
RUN conda install --yes scipy
RUN conda install --yes gensim
RUN pip install annoy
RUN conda config --add channels conda-forge
RUN conda install --yes spacy
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ADD my-app.tar /usr/src/app
WORKDIR /usr/src/app/source
I build the image with:
docker build -t my-app-poc .
Start the container and enter command:
docker run -i -t -p 9998:9998
In the Docker image's bash I run the script:
python Service.py
Which starts correctly:
Wed Apr 5 13:09:51 2017 Server Starts - :9998
But when I enter the address on my host:
http://localhost:9998
Nothing happens. I've tried also put EXPOSE 9998
at the end of my DockerFile
but it wasn't help.
If I enter docker-machine
address on my host:
http://192.168.99.100:9989/
it works. But I want to run that image on regular server, not my local machine - so everything should be exposed to localhost.
I tried it on Windows 7.
Do you have any idea how to run this?
I will be very glad for your help!