{"action":"opened","issue":{"url":"https://api.github.com/repos/just-containers/s6-overlay/issues/114","labels_url":"https://api.github.com/repos/just-containers/s6-overlay/issues/114/labels{/name}","comments_url":"https://api.github.com/repos/just-containers/s6-overlay/issues/114/comments","events_url":"https://api.github.com/repos/just-containers/s6-overlay/issues/114/events","html_url":"https://github.com/just-containers/s6-overlay/issues/114","id":121366028,"number":114,"title":"Make sure services have been started before executing CMD","user":{"login":"janeczku","id":3813921,"avatar_url":"https://avatars.githubusercontent.com/u/3813921?v=3","gravatar_id":"","url":"https://api.github.com/users/janeczku","html_url":"https://github.com/janeczku","followers_url":"https://api.github.com/users/janeczku/followers","following_url":"https://api.github.com/users/janeczku/following{/other_user}","gists_url":"https://api.github.com/users/janeczku/gists{/gist_id}","starred_url":"https://api.github.com/users/janeczku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/janeczku/subscriptions","organizations_url":"https://api.github.com/users/janeczku/orgs","repos_url":"https://api.github.com/users/janeczku/repos","events_url":"https://api.github.com/users/janeczku/events{/privacy}","received_events_url":"https://api.github.com/users/janeczku/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-09T23:30:41Z","updated_at":"2015-12-09T23:30:41Z","closed_at":null,"body":"It looks like there is currently no guarantee that all user defined services are actually started before the CMD is executed so we might have a race condition when the CMD depends on a service to be running.\r\nCould we leverage `s6-svwait` to make sure that services have been started before running the CMD?\r\n\r\nIn https://github.com/just-containers/s6-overlay/blob/master/builder/overlay-rootfs/etc/s6/init/init-stage2#L136 insert something like this:\r\n\r\n```BASH\r\n        if\r\n        {\r\n          pipeline { s6-ls -0 -- /var/run/s6/etc/services.d }\r\n          forstdin -0 -p -- i\r\n          importas -u i i\r\n          if { s6-svwait -t 1000 -u /var/run/s6/services/${i} }\r\n        }\r\n        if { s6-echo -- \"[services.d] done.\" }\r\n\r\n```"}}