tgbs 14 Posted April 19, 2022 I read from web that Linux service are created via Fork() . But this cannot be used in linux containers. Because engine look for master pid and finish execution if it stopped. Is there any skeleton of such a program. I will use the application in a docker, which will be accessed through Nginx. Share this post Link to post
darnocian 84 Posted April 20, 2022 (edited) Using fork() is the Linux way, but you don't have to worry about that in a docker environment. In Docker, you can simply rely on creating a simple console app. You then just rely on Docker Swarm or Kubernetes to be running on the host machine running the container as required. You simply need to provide a CMD or ENTRYPOINT in the Dockerfile referencing your command line application. I forgot you mentioned NGINX... So it depends how 'pure' you want to be... the 'pure' way is you have 2 containers: 1) nginx and 2) your app.... However, there is nothing stopping you from creating one container with NGINX and your application in it, but it is a container anti-pattern. Edited April 20, 2022 by darnocian Share this post Link to post