I'm trying to understand how runc works and stuck here:
When the container is about to be started (using "runc run ") and in the init phase, can anybody help me understand where does the code logic go after command /proc/self/exe init gets executed?
Does it result in the command "runc init"? I tried to execute runc init from the shell and it failed due to missing _LIBCONTAINER_LOGLEVEL variable. (Error: panic: strconv.Atoi: parsing "": invalid syntax)
Is there a function called init() somewhere that gets invoked (which later invokes the "sh" command in a container)?
I have been cracking my head behind this and unable to trace the steps. Any ideas/help appreciated!!
From Libcontainer Docs:
Because containers are spawned in a two step process you will need a binary that will be executed as the init process for the container. In libcontainer, we use the current binary (/proc/self/exe) to be executed as the init process, and use arg "init", we call the first step process "bootstrap", so you always need a "init" function as the entry of "bootstrap".
Tried to check all the init functions within the codebase but could not find the one where the execution will proceed to?