1

I am looking to run a Scrapy project in a docker container as part of a larger docker-compose application. My idea is to install Ubuntu base image, add all the dependencies and then get it going. Ideally I would like the container to continually run and when I want to run the Scrapy project I will run docker exec into it. The long term goal would be to have the Scrapy as a scheduled task running every day.

How would I go about this?

I've tried: CMD ["/bin/sh"] but the container exits straight away with code 0.

1 Answers1

1

Because /bin/sh exits if it see it's standard input closed and there is no script to run.

Here is a similar question that explains in detail what you need to do How can I keep container running on Kubernetes?

In short your command should be:

CMD exec /bin/bash -c "trap : TERM INT; sleep infinity & wait"
Community
  • 1
  • 1
Vlad
  • 9,180
  • 5
  • 48
  • 67