From 3a1200f9f11a016abd75588fa3812fb5505b2c3a Mon Sep 17 00:00:00 2001 From: David Calavera Date: Mon, 9 Nov 2015 15:28:14 -0500 Subject: [PATCH] Revert "Tidy config/hostconfig structures" This reverts commit ad5052df234e4f48a93e22694f91fda36bb9e95d. Signed-off-by: David Calavera --- image/fixtures/pre1.9/expected_computed_id | 2 +- image/fixtures/pre1.9/expected_config | 3 +- runconfig/config.go | 32 +++++------ runconfig/hostconfig.go | 65 ++++++++++------------ 4 files changed, 47 insertions(+), 55 deletions(-) diff --git a/image/fixtures/pre1.9/expected_computed_id b/image/fixtures/pre1.9/expected_computed_id index 98a34f8c4c..c27b0b6a20 100644 --- a/image/fixtures/pre1.9/expected_computed_id +++ b/image/fixtures/pre1.9/expected_computed_id @@ -1 +1 @@ -sha256:731d62ca192955d38edd4333c89aad021002b1e570daa6bb9f8f06b500c76a4d +sha256:fd6ebfedda8ea140a9380767e15bd32c6e899303cfe34bc4580c931f2f816f89 diff --git a/image/fixtures/pre1.9/expected_config b/image/fixtures/pre1.9/expected_config index e29c9d349f..121efe1fe6 100644 --- a/image/fixtures/pre1.9/expected_config +++ b/image/fixtures/pre1.9/expected_config @@ -1 +1,2 @@ -{"architecture":"amd64","config":{"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Cmd":null,"Entrypoint":["/go/bin/dnsdock"],"Env":["PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOLANG_VERSION=1.4.1","GOPATH=/go"],"Hostname":"03797203757d","Image":"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02","Labels":{},"OnBuild":[],"OpenStdin":false,"StdinOnce":false,"Tty":false,"Volumes":null,"WorkingDir":"/go","Domainname":"","User":""},"container":"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253","container_config":{"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Cmd":["/bin/sh","-c","#(nop) ENTRYPOINT [\"/go/bin/dnsdock\"]"],"Entrypoint":["/go/bin/dnsdock"],"Env":["PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOLANG_VERSION=1.4.1","GOPATH=/go"],"Hostname":"03797203757d","Image":"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02","Labels":{},"OnBuild":[],"OpenStdin":false,"StdinOnce":false,"Tty":false,"Volumes":null,"WorkingDir":"/go","Domainname":"","User":""},"created":"2015-08-19T16:49:11.368300679Z","docker_version":"1.6.2","layer_id":"sha256:31176893850e05d308cdbfef88877e460d50c8063883fb13eb5753097da6422a","os":"linux","parent_id":"sha256:ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02"} +{"architecture":"amd64","config":{"Hostname":"03797203757d","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOLANG_VERSION=1.4.1","GOPATH=/go"],"Cmd":null,"Image":"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02","Volumes":null,"WorkingDir":"/go","Entrypoint":["/go/bin/dnsdock"],"OnBuild":[],"Labels":{}},"container":"d91be3479d5b1e84b0c00d18eea9dc777ca0ad166d51174b24283e2e6f104253","container_config":{"Hostname":"03797203757d","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin","GOLANG_VERSION=1.4.1","GOPATH=/go"],"Cmd":["/bin/sh","-c","#(nop) ENTRYPOINT [\"/go/bin/dnsdock\"]"],"Image":"ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02","Volumes":null,"WorkingDir":"/go","Entrypoint":["/go/bin/dnsdock"],"OnBuild":[],"Labels":{}},"created":"2015-08-19T16:49:11.368300679Z","docker_version":"1.6.2","layer_id":"sha256:31176893850e05d308cdbfef88877e460d50c8063883fb13eb5753097da6422a","os":"linux","parent_id":"sha256:ec3025ca8cc9bcab039e193e20ec647c2da3c53a74020f2ba611601f9b2c6c02"} + diff --git a/runconfig/config.go b/runconfig/config.go index 93ddb46cb5..47e895871e 100644 --- a/runconfig/config.go +++ b/runconfig/config.go @@ -17,32 +17,28 @@ import ( // All fields added to this struct must be marked `omitempty` to keep getting // predictable hashes from the old `v1Compatibility` configuration. type Config struct { - - // Applicable to all platforms + Hostname string // Hostname + Domainname string // Domainname + User string // User that will run the command(s) inside the container AttachStdin bool // Attach the standard input, makes possible user interaction AttachStdout bool // Attach the standard output AttachStderr bool // Attach the standard error - Cmd *stringutils.StrSlice // Command to run when starting the container - Entrypoint *stringutils.StrSlice // Entrypoint to run when starting the container - Env []string // List of environment variable to set in the container ExposedPorts map[nat.Port]struct{} `json:",omitempty"` // List of exposed ports - Hostname string // Hostname - Image string // Name of the image as it was passed by the operator (eg. could be symbolic) - Labels map[string]string // List of labels set to this container - MacAddress string `json:",omitempty"` // Mac Address of the container - NetworkDisabled bool `json:",omitempty"` // Is network disabled (--net=none) - OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile + PublishService string `json:",omitempty"` // Name of the network service exposed by the container + Tty bool // Attach standard streams to a tty, including stdin if it is not closed. OpenStdin bool // Open stdin StdinOnce bool // If true, close stdin after the 1 attached client disconnects. - Tty bool // Attach standard streams to a tty, including stdin if it is not closed. + Env []string // List of environment variable to set in the container + Cmd *stringutils.StrSlice // Command to run when starting the container + Image string // Name of the image as it was passed by the operator (eg. could be symbolic) Volumes map[string]struct{} // List of volumes (mounts) used for the container WorkingDir string // Current directory (PWD) in the command will be launched - - // Applicable to UNIX platforms - Domainname string // Domainname - PublishService string `json:",omitempty"` // Name of the network service exposed by the container - StopSignal string `json:",omitempty"` // Signal to stop a container - User string // User that will run the command(s) inside the container + Entrypoint *stringutils.StrSlice // Entrypoint to run when starting the container + NetworkDisabled bool `json:",omitempty"` // Is network disabled + MacAddress string `json:",omitempty"` // Mac Address of the container + OnBuild []string // ONBUILD metadata that were defined on the image Dockerfile + Labels map[string]string // List of labels set to this container + StopSignal string `json:",omitempty"` // Signal to stop a container } // DecodeContainerConfig decodes a json encoded config into a ContainerConfigWrapper diff --git a/runconfig/hostconfig.go b/runconfig/hostconfig.go index dae899c4e8..b48166e598 100644 --- a/runconfig/hostconfig.go +++ b/runconfig/hostconfig.go @@ -168,51 +168,46 @@ type LogConfig struct { // Here, "non-portable" means "dependent of the host we are running on". // Portable information *should* appear in Config. type HostConfig struct { - // Applicable to all platforms - Binds []string // List of volume bindings for this container - ContainerIDFile string // File (path) where the containerId is written - CPUShares int64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers) - LogConfig LogConfig // Configuration of the logs for this container - NetworkMode NetworkMode // Network mode to use for the container - PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host - RestartPolicy RestartPolicy // Restart policy to be used for the container - VolumeDriver string // Name of the volume driver used to mount volumes - VolumesFrom []string // List of volumes to take from other container - - // Applicable to UNIX platforms - BlkioWeight uint16 // Block IO weight (relative weight vs. other containers) - CapAdd *stringutils.StrSlice // List of kernel capabilities to add to the container - CapDrop *stringutils.StrSlice // List of kernel capabilities to remove from the container - CgroupParent string // Parent cgroup. + Binds []string // List of volume bindings for this container + ContainerIDFile string // File (path) where the containerId is written + Memory int64 // Memory limit (in bytes) + MemoryReservation int64 // Memory soft limit (in bytes) + MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap + KernelMemory int64 // Kernel memory limit (in bytes) + CPUShares int64 `json:"CpuShares"` // CPU shares (relative weight vs. other containers) CPUPeriod int64 `json:"CpuPeriod"` // CPU CFS (Completely Fair Scheduler) period - CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota CpusetCpus string // CpusetCpus 0-2, 0,1 CpusetMems string // CpusetMems 0-2, 0,1 - Devices []DeviceMapping // List of devices to map inside the container + CPUQuota int64 `json:"CpuQuota"` // CPU CFS (Completely Fair Scheduler) quota + BlkioWeight uint16 // Block IO weight (relative weight vs. other containers) + OomKillDisable bool // Whether to disable OOM Killer or not + MemorySwappiness *int64 // Tuning container memory swappiness behaviour + Privileged bool // Is the container in privileged mode + PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host + Links []string // List of links (in the name:alias form) + PublishAllPorts bool // Should docker publish all exposed port for the container DNS []string `json:"Dns"` // List of DNS server to lookup DNSOptions []string `json:"DnsOptions"` // List of DNSOption to look for DNSSearch []string `json:"DnsSearch"` // List of DNSSearch to look for ExtraHosts []string // List of extra hosts + VolumesFrom []string // List of volumes to take from other container + Devices []DeviceMapping // List of devices to map inside the container + NetworkMode NetworkMode // Network namespace to use for the container + IpcMode IpcMode // IPC namespace to use for the container // Unix specific + PidMode PidMode // PID namespace to use for the container // Unix specific + UTSMode UTSMode // UTS namespace to use for the container // Unix specific + CapAdd *stringutils.StrSlice // List of kernel capabilities to add to the container + CapDrop *stringutils.StrSlice // List of kernel capabilities to remove from the container GroupAdd []string // List of additional groups that the container process will run as - IpcMode IpcMode // IPC namespace to use for the container - KernelMemory int64 // Kernel memory limit (in bytes) - Links []string // List of links (in the name:alias form) - Memory int64 // Memory limit (in bytes) - MemoryReservation int64 // Memory soft limit (in bytes) - MemorySwap int64 // Total memory usage (memory + swap); set `-1` to disable swap - MemorySwappiness *int64 // Tuning container memory swappiness behaviour - OomKillDisable bool // Whether to disable OOM Killer or not - PidMode PidMode // PID namespace to use for the container - Privileged bool // Is the container in privileged mode - PublishAllPorts bool // Should docker publish all exposed port for the container - ReadonlyRootfs bool // Is the container root filesystem in read-only + RestartPolicy RestartPolicy // Restart policy to be used for the container SecurityOpt []string // List of string values to customize labels for MLS systems, such as SELinux. + ReadonlyRootfs bool // Is the container root filesystem in read-only // Unix specific Ulimits []*ulimit.Ulimit // List of ulimits to be set in the container - UTSMode UTSMode // UTS namespace to use for the container - - // Applicable to Windows - ConsoleSize [2]int // Initial console size - Isolation IsolationLevel // Isolation level of the container (eg default, hyperv) + LogConfig LogConfig // Configuration of the logs for this container + CgroupParent string // Parent cgroup. + ConsoleSize [2]int // Initial console size on Windows + VolumeDriver string // Name of the volume driver used to mount volumes + Isolation IsolationLevel // Isolation level of the container (eg default, hyperv) } // DecodeHostConfig creates a HostConfig based on the specified Reader.