'Not able to create a docker image for splash scrapy app python?

I am using scrapy-splash to rendering javascript in web scrapping. So, splash run in a separate container. see here https://splash.readthedocs.io/en/latest/install.html

Now, I want to create the docker file for my python app which includes scrapy + splash both code but splash run in a separate container so not able to create a image.

My Dockerfile

FROM scrapinghub/splash:latest
WORKDIR /usr/src/snapshot
VOLUME ["/usr/src/snapshot"]
ADD requirements.txt ./
RUN pip install -r requirements.txt
ADD . ./
EXPOSE 8050
ENTRYPOINT ["/usr/src/snapshot/init_container.sh"]

and in init_container.sh , I am just doing Python3 /usr/src/snapshot/function.py and in the output I am getting Connection was refused by other side : connection refused The reason is that splash is not running on localhost or inside the container.i.e. http://localhost:8080 mentioned here Not able to create a docker image for splash scrapy app python?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source