{"id":15747754,"url":"https://github.com/developer-guy/handling-multiprocess-in-container","last_synced_at":"2026-01-11T13:02:03.037Z","repository":{"id":104877117,"uuid":"328416584","full_name":"developer-guy/handling-multiprocess-in-container","owner":"developer-guy","description":"Handling Multi-Process in container using Supervisord init-system","archived":false,"fork":false,"pushed_at":"2021-01-10T15:49:08.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T06:41:36.988Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developer-guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-10T15:35:47.000Z","updated_at":"2021-02-25T19:25:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"aed11350-4add-4cc0-88ef-99d53c962680","html_url":"https://github.com/developer-guy/handling-multiprocess-in-container","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/developer-guy/handling-multiprocess-in-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fhandling-multiprocess-in-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fhandling-multiprocess-in-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fhandling-multiprocess-in-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fhandling-multiprocess-in-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developer-guy","download_url":"https://codeload.github.com/developer-guy/handling-multiprocess-in-container/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developer-guy%2Fhandling-multiprocess-in-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28304263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T11:18:18.743Z","status":"ssl_error","status_checked_at":"2026-01-11T11:07:56.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T05:21:40.637Z","updated_at":"2026-01-11T13:02:03.015Z","avatar_url":"https://github.com/developer-guy.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Handling-multiprocess-in-container\nHandling Multi-Process in container using Supervisord init-system\n\n# Test without init system\nLet's display the content of the Dockerfile to see what is inside of the Dockerfile\n```Dockerfile\nFROM alpine\nENTRYPOINT [\"sleep\",\"120\"]\n```\nBuild docker image with the following command\n```bash\n$ docker image build -t without-init-system:latest -f without-init-system/ without-init-system\n```\nRun the docker image built above\n```bash\n# Don't forget to add --init flag\n$ docker container run --rm --init --name without-init without-init-system:latest\n```\n\u003e The --init flag inserts a tiny init-process into the container as the main process, and handles reaping of all processes when the container exits. Handling such processes this way is superior to using a full-fledged init process such as sysvinit , upstart , or systemd to handle process lifecycle within your container.\n\nIn the second terminal connect to the container to see what processes are working inside of the container\n```bash\n$ docker container exec -ti without-init sh\n\n# As soon as you connect to the container, you should run \"pstree -p\" command to see processes that are working in the container\n/ # pstree -p\ninit(1)---sleep(6)\n```\n\n# Test with init sytem - Handle multiple sleep process at once\nLet's display the content of the Dockerfile to see what is inside of the Dockerfile\n```Dockerfile\nFROM alpine\nRUN apk update \u0026\u0026 apk add --no-cache supervisor\nRUN mkdir -p /etc/supervisor.d\nCOPY supervisord.conf /etc/supervisord.conf\nENTRYPOINT [\"/usr/bin/supervisord\", \"-c\", \"/etc/supervisord.conf\"]\n```\nBuild docker image with the following command\n```bash\n$ docker image build -t with-init-system:latest -f with-init-system/ with-init-system\n```\nRun the docker image built above\n```bash\n# Don't forget to add --init flag\n$ docker container run --rm --init --name with-init with-init-system:latest\n```\nIn the second terminal connect to the container to see what processes are working inside of the container\n```bash\n$ docker container exec -ti without-init sh\n\n# As soon as you connect to the container, you should run \"pstree -p\" command to see processes that are working in the container\n/ # pstree -p\ninit(1)---supervisord(7)-+-sleep(9)\n                         `-sleep(10)\n```\nTo test it kill the one of the sleep process\n```bash\n/ # kill -9 \n/ # pstree -p\ninit(1)---supervisord(7)-+-sleep(10)\n```\n# References\n* https://docs.docker.com/config/containers/multi-service_container/\n* https://dockernaut.wordpress.com/2019/03/13/one-process-per-container-vs-many-process-pattern/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fhandling-multiprocess-in-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloper-guy%2Fhandling-multiprocess-in-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloper-guy%2Fhandling-multiprocess-in-container/lists"}