创建和更新container
时需要涉及到container
的config
(cluster\config.go
):
// ContainerConfig is exported
// TODO store affinities and constraints in their own fields
type ContainerConfig struct {
container.Config
HostConfig container.HostConfig
NetworkingConfig network.NetworkingConfig
}
// OldContainerConfig contains additional fields for backward compatibility
// This should be removed after we stop supporting API versions <= 1.8
type OldContainerConfig struct {
ContainerConfig
Memory int64
MemorySwap int64
CPUShares int64 `json:"CpuShares"`
CPUSet string `json:"Cpuset"`
}
其中container
这个package
定义在/vendor/github.com/docker/engine-api/types/container/config.go
,container.Config
包含不依赖于host
的container
的config
;依赖于host
的config
定义在container.HostConfig
;而container
网络相关的config
保存在network.NetworkingConfig
。
有疑问加站长微信联系(非本文作者)