ContainerRun
ExecuteCreate
runtime.NewContainer
-》libpod/runtime_ctr.go runtime.newContainer
—》libpod/runtime_ctr.go runtime.setupContainer
—-》libpod/container_internal.go setupStorage 创建rootfs目录
——》libpod/storage.go CreateContainerStorage 准备container的work dir和run dir,读取镜像信息来设置container的meta信息,创建writable layer
——-> store.CreateContainer 如果使用image,则找到imageTopLayer。创建writable layer作为容器层。会把所有容器信息写到 containers.json。
———> LayerStore.Create 创建writable layer
�
�
writable layer:
在 /var/lib/containers/storage/overlay/4fa8f612646666389681a590b71ce8fad26675e37580f8a3f99b1e6cce02c8d1/
work dir:
一般用来存储 container log files, files that will be bind mounted into the container (e.g. the resolv.conf we made for the container), and other per-container content. 但不是rootfs的一部分
�
/var/lib/containers/storage/overlay-containers/45553218b7b33eac2afcb7e02660b6582baecb53f55fbceeb0eb2f205a8e542a/userdata
libpod/runtime_ctr.go PrepareVolumeOnCreateContainer
�-》 libpod/container_internal.go mountStorage 准备rootfs�,这里会解析到rootfsOverlay
—》如果指定了rootfs,设置mountPoint
—》如果没有指定rootfs,执行container.mount得到mountPoint
�
�
Container.Start
�
prepareToStart
-> Container.prepare sets up other required resources like net namespaces
�
�