LCOW: Remove CommonContainer - just Container
Signed-off-by: John Howard <jhoward@microsoft.com> Upstream-commit: 55f8828eec1ff6c70628a0b6f22bea175ce36159 Component: engine
This commit is contained in:
@@ -58,9 +58,8 @@ var (
|
||||
errInvalidNetwork = fmt.Errorf("invalid network settings while building port map info")
|
||||
)
|
||||
|
||||
// CommonContainer holds the fields for a container which are
|
||||
// applicable across all platforms supported by the daemon.
|
||||
type CommonContainer struct {
|
||||
// Container holds the structure defining a container object.
|
||||
type Container struct {
|
||||
StreamConfig *stream.Config
|
||||
// embed for Container to support states directly.
|
||||
*State `json:"State"` // Needed for Engine API version <= 1.11
|
||||
@@ -95,21 +94,31 @@ type CommonContainer struct {
|
||||
LogCopier *logger.Copier `json:"-"`
|
||||
restartManager restartmanager.RestartManager
|
||||
attachContext *attachContext
|
||||
|
||||
// Fields here are specific to Unix platforms
|
||||
AppArmorProfile string
|
||||
HostnamePath string
|
||||
HostsPath string
|
||||
ShmPath string
|
||||
ResolvConfPath string
|
||||
SeccompProfile string
|
||||
NoNewPrivileges bool
|
||||
|
||||
// Fields here are specific to Windows
|
||||
NetworkSharedContainerID string
|
||||
}
|
||||
|
||||
// NewBaseContainer creates a new container with its
|
||||
// basic configuration.
|
||||
func NewBaseContainer(id, root string) *Container {
|
||||
return &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
ID: id,
|
||||
State: NewState(),
|
||||
ExecCommands: exec.NewStore(),
|
||||
Root: root,
|
||||
MountPoints: make(map[string]*volume.MountPoint),
|
||||
StreamConfig: stream.NewConfig(),
|
||||
attachContext: &attachContext{},
|
||||
},
|
||||
ID: id,
|
||||
State: NewState(),
|
||||
ExecCommands: exec.NewStore(),
|
||||
Root: root,
|
||||
MountPoints: make(map[string]*volume.MountPoint),
|
||||
StreamConfig: stream.NewConfig(),
|
||||
attachContext: &attachContext{},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,7 @@ import (
|
||||
|
||||
func TestContainerStopSignal(t *testing.T) {
|
||||
c := &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &container.Config{},
|
||||
},
|
||||
Config: &container.Config{},
|
||||
}
|
||||
|
||||
def, err := signal.ParseSignal(signal.DefaultStopSignal)
|
||||
@@ -27,9 +25,7 @@ func TestContainerStopSignal(t *testing.T) {
|
||||
}
|
||||
|
||||
c = &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &container.Config{StopSignal: "SIGKILL"},
|
||||
},
|
||||
Config: &container.Config{StopSignal: "SIGKILL"},
|
||||
}
|
||||
s = c.StopSignal()
|
||||
if s != 9 {
|
||||
@@ -39,9 +35,7 @@ func TestContainerStopSignal(t *testing.T) {
|
||||
|
||||
func TestContainerStopTimeout(t *testing.T) {
|
||||
c := &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &container.Config{},
|
||||
},
|
||||
Config: &container.Config{},
|
||||
}
|
||||
|
||||
s := c.StopTimeout()
|
||||
@@ -51,9 +45,7 @@ func TestContainerStopTimeout(t *testing.T) {
|
||||
|
||||
stopTimeout := 15
|
||||
c = &Container{
|
||||
CommonContainer: CommonContainer{
|
||||
Config: &container.Config{StopTimeout: &stopTimeout},
|
||||
},
|
||||
Config: &container.Config{StopTimeout: &stopTimeout},
|
||||
}
|
||||
s = c.StopSignal()
|
||||
if s != 15 {
|
||||
|
||||
@@ -26,21 +26,6 @@ const (
|
||||
containerSecretMountPath = "/run/secrets"
|
||||
)
|
||||
|
||||
// Container holds the fields specific to unixen implementations.
|
||||
// See CommonContainer for standard fields common to all containers.
|
||||
type Container struct {
|
||||
CommonContainer
|
||||
|
||||
// Fields below here are platform specific.
|
||||
AppArmorProfile string
|
||||
HostnamePath string
|
||||
HostsPath string
|
||||
ShmPath string
|
||||
ResolvConfPath string
|
||||
SeccompProfile string
|
||||
NoNewPrivileges bool
|
||||
}
|
||||
|
||||
// ExitStatus provides exit reasons for a container.
|
||||
type ExitStatus struct {
|
||||
// The exit code with which the container exited.
|
||||
|
||||
@@ -17,15 +17,6 @@ const (
|
||||
containerInternalConfigsDirPath = `C:\ProgramData\Docker\internal\configs`
|
||||
)
|
||||
|
||||
// Container holds fields specific to the Windows implementation. See
|
||||
// CommonContainer for standard fields common to all containers.
|
||||
type Container struct {
|
||||
CommonContainer
|
||||
|
||||
// Fields below here are platform specific.
|
||||
NetworkSharedContainerID string
|
||||
}
|
||||
|
||||
// ExitStatus provides exit reasons for a container.
|
||||
type ExitStatus struct {
|
||||
// The exit code with which the container exited.
|
||||
|
||||
Reference in New Issue
Block a user