{"id":246,"date":"2022-02-12T23:00:00","date_gmt":"2022-02-13T04:00:00","guid":{"rendered":"http:\/\/sycured.127.0.0.1.sslip.io\/?p=246"},"modified":"2024-01-14T11:49:10","modified_gmt":"2024-01-14T16:49:10","slug":"container-multiple-processes","status":"publish","type":"post","link":"http:\/\/10.42.0.68:8080\/blog\/container-multiple-processes","title":{"rendered":"Container with multiple processes"},"content":{"rendered":"\n
Last week, I needed to create a docker image doing a simple thing:<\/p>\n\n\n\n
But I’ve a hard part: every 15 minutes, I need to look if a new version of the XML file is available and in case, running the entire process.<\/p>\n\n\n\n
Let’s go to see how I did it<\/p>\n\n\n\n\n\n\n\n
I use Python container based on alpine linux<\/a> as the base, adding an environment variable to avoid PIP cache<\/a>.<\/p>\n\n\n\n To have multiple processes inside the contianer, I use s6-overlay<\/a> and I think to rewrite the global path<\/a> because by default it’s not including the path where Python binaries (pip, python) are installed.<\/p>\n\n\n\n S6-overlay permits to define dependencies between processes and it’s exactly what I need because:<\/p>\n\n\n\n To setup cron, we have few steps inside the Dockerfile:<\/p>\n\n\n\n Steps:<\/p>\n\n\n\n Steps:<\/p>\n\n\n\n Finally, we’ll use s6 has the entrypoint<\/a> for this container<\/p>\n\n\n\nProcess with dependencies and type of run<\/h2>\n\n\n\n
\n
cron<\/h3>\n\n\n\n
\n
nginx unit<\/h3>\n\n\n\n
\n
docker-entrypoint<\/h3>\n\n\n\n
\n
Entrypoint<\/h3>\n\n\n\n
Link<\/h2>\n\n\n\n