icon-cookie
The website uses cookies to optimize your user experience. Using this website grants us the permission to collect certain information essential to the provision of our services to you, but you may change the cookie settings within your browser any time you wish. Learn more
I agree
blank_error__heading
blank_error__body
Text direction?

runC源码分析——主体调用链

阅读 4500

本文将简单的对runC的源码调用主体逻辑进行梳理,为跟系统的阅读runC源码。 ##runC总体调用逻辑 下图中,runC源码逻辑跳转流程总体上分为三步: main入口 ——> runC处理 ——> libcontainer处理。

runC其实就是在libcontainer的基础上进行了封装成各个Command。

具体runC的各个Command的调用链见如下:

##runC处理

###checkpoint

checkpointCommand(main.go) —> checkpointCommand(checkpoint.go)

###container

createCommand(main.go)—>createCommand(create.go)—>startContainer(untils_linux.go)—>run(untils_linux.go) deleteCommand(main.go)—>deleteCommand(delete.go)—>destroy(untils_linux.go) eventsCommand(main.go)—>eventsCommand(events.go) execCommand(main.go)—>execCommand(exec.go)—>execProcess(exec.go)->run(untils_linux.go) initCommand(main.go)—>initCommand(main_unix.go) killCommand(main.go)—>killCommand(kill.go) listCommand(main.go)—>getContainers(list.go) pauseCommand(main.go) —>pauseCommand(pause.go) psCommand(main.go)—>psCommand(ps.go) restoreCommand(main.go)—>restoreCommand(restore.go)—>restoreContainer(restore.go) resumeCommand(main.go)—>resumeCommand(pause.go) runCommand(main.go)—>runCommand(run.go)—>startContainer(untils_linux.go) specCommand(main.go)—>specCommand(spec.go) end startCommand(main.go)—>startCommand(start.go) stateCommand(main.go)—>stateCommand(state.go) updateCommand(main.go)—>updateCommand(update.go)

##runC to libcontainer ###checkpoint

checkpointCommand(checkpoint.go)—> Checkpoint(libcontainer/container_linux.go) ###container run(untils_linux.go)—>Run(libcontainer/container_linux.go) destroy(untils_linux.go)—>Destroy(libcontainer/container_linux.go) eventsCommand(events.go)—>Status(libcontainer/container_linux.go) execProcess(exec.go)—>Status\Stopped\State(libcontainer/container_linux.go) || run(untils_linux.go)—>Start\Run\Destroy(libcontainer/container_linux.go) initCommand(main_unix.go)—>StartInitialization(libcontainer/factory_linux.go) killCommand(kill.go)—>Signal(libcontainer/container_linux.go) getContainers(list.go)—>Status\State\Stopped(libcontainer/container_linux.go) pauseCommand(pause.go)—>Pause(libcontainer/container_linux.go) psCommand(ps.go)—>exec.Command("ps", psArgs...).Output() restoreContainer(restore.go)—>Restore(libcontainer/container_linux.go) resumeCommand(pause.go)—>Resume(libcontainer/container_linux.go) startContainer(untils_linux.go)—>Run(libcontainer/factory.go) startCommand(start.go)—>Exec(libcontainer/container_linux.go) stateCommand(state.go)—>State(libcontainer/container_linux.go) updateCommand(update.go)—>Set(libcontainer/container_linux.go)

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

Measure
Measure
Related Notes
Get a free MyMarkup account to save this article and view it later on any device.
Create account

End User License Agreement

Summary | 1 Annotations
runC其实就是在libcontainer的基础上进行了封装成各个Command
2020/06/21 07:18