Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -681,13 +681,7 @@ func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container) |
| 681 | 681 |
s.Process.Terminal = c.Config.Tty |
| 682 | 682 |
|
| 683 | 683 |
s.Hostname = c.Config.Hostname |
| 684 |
- // There isn't a field in the OCI for the NIS domainname, but luckily there |
|
| 685 |
- // is a sysctl which has an identical effect to setdomainname(2) so there's |
|
| 686 |
- // no explicit need for runtime support. |
|
| 687 |
- s.Linux.Sysctl = make(map[string]string) |
|
| 688 |
- if c.Config.Domainname != "" {
|
|
| 689 |
- s.Linux.Sysctl["kernel.domainname"] = c.Config.Domainname |
|
| 690 |
- } |
|
| 684 |
+ setLinuxDomainname(c, s) |
|
| 691 | 685 |
|
| 692 | 686 |
return nil |
| 693 | 687 |
} |
| 694 | 688 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+package daemon // import "github.com/docker/docker/daemon" |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "github.com/docker/docker/container" |
|
| 4 |
+ "github.com/opencontainers/runtime-spec/specs-go" |
|
| 5 |
+) |
|
| 6 |
+ |
|
| 7 |
+func setLinuxDomainname(c *container.Container, s *specs.Spec) {
|
|
| 8 |
+ // There isn't a field in the OCI for the NIS domainname, but luckily there |
|
| 9 |
+ // is a sysctl which has an identical effect to setdomainname(2) so there's |
|
| 10 |
+ // no explicit need for runtime support. |
|
| 11 |
+ s.Linux.Sysctl = make(map[string]string) |
|
| 12 |
+ if c.Config.Domainname != "" {
|
|
| 13 |
+ s.Linux.Sysctl["kernel.domainname"] = c.Config.Domainname |
|
| 14 |
+ } |
|
| 15 |
+} |
| ... | ... |
@@ -43,9 +43,6 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
|
| 43 | 43 |
// this is done in VMCompute. Further, we couldn't do it for Hyper-V |
| 44 | 44 |
// containers anyway. |
| 45 | 45 |
|
| 46 |
- // In base spec |
|
| 47 |
- s.Hostname = c.FullHostname() |
|
| 48 |
- |
|
| 49 | 46 |
if err := daemon.setupSecretDir(c); err != nil {
|
| 50 | 47 |
return nil, err |
| 51 | 48 |
} |
| ... | ... |
@@ -128,8 +125,9 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
|
| 128 | 128 |
// In s.Process |
| 129 | 129 |
s.Process.Cwd = c.Config.WorkingDir |
| 130 | 130 |
s.Process.Env = c.CreateDaemonEnvironment(c.Config.Tty, linkedEnv) |
| 131 |
+ s.Process.Terminal = c.Config.Tty |
|
| 132 |
+ |
|
| 131 | 133 |
if c.Config.Tty {
|
| 132 |
- s.Process.Terminal = c.Config.Tty |
|
| 133 | 134 |
s.Process.ConsoleSize = &specs.Box{
|
| 134 | 135 |
Height: c.HostConfig.ConsoleSize[0], |
| 135 | 136 |
Width: c.HostConfig.ConsoleSize[1], |
| ... | ... |
@@ -228,6 +226,8 @@ func (daemon *Daemon) createSpec(c *container.Container) (*specs.Spec, error) {
|
| 228 | 228 |
// Sets the Windows-specific fields of the OCI spec |
| 229 | 229 |
func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.Spec, isHyperV bool) error {
|
| 230 | 230 |
|
| 231 |
+ s.Hostname = c.FullHostname() |
|
| 232 |
+ |
|
| 231 | 233 |
if len(s.Process.Cwd) == 0 {
|
| 232 | 234 |
// We default to C:\ to workaround the oddity of the case that the |
| 233 | 235 |
// default directory for cmd running as LocalSystem (or |
| ... | ... |
@@ -360,13 +360,20 @@ func (daemon *Daemon) createSpecWindowsFields(c *container.Container, s *specs.S |
| 360 | 360 |
// TODO: @jhowardmsft LCOW Support. We need to do a lot more pulling in what can |
| 361 | 361 |
// be pulled in from oci_linux.go. |
| 362 | 362 |
func (daemon *Daemon) createSpecLinuxFields(c *container.Container, s *specs.Spec) error {
|
| 363 |
+ s.Root = &specs.Root{
|
|
| 364 |
+ Path: "rootfs", |
|
| 365 |
+ Readonly: c.HostConfig.ReadonlyRootfs, |
|
| 366 |
+ } |
|
| 367 |
+ |
|
| 368 |
+ s.Hostname = c.Config.Hostname |
|
| 369 |
+ setLinuxDomainname(c, s) |
|
| 370 |
+ |
|
| 363 | 371 |
if len(s.Process.Cwd) == 0 {
|
| 364 | 372 |
s.Process.Cwd = `/` |
| 365 | 373 |
} |
| 366 | 374 |
s.Process.Args = append([]string{c.Path}, c.Args...)
|
| 367 |
- s.Root.Path = "rootfs" |
|
| 368 |
- s.Root.Readonly = c.HostConfig.ReadonlyRootfs |
|
| 369 | 375 |
|
| 376 |
+ // Note these are against the UVM. |
|
| 370 | 377 |
setResourcesInSpec(c, s, true) // LCOW is Hyper-V only |
| 371 | 378 |
|
| 372 | 379 |
capabilities, err := caps.TweakCapabilities(oci.DefaultCapabilities(), c.HostConfig.CapAdd, c.HostConfig.CapDrop, c.HostConfig.Capabilities, c.HostConfig.Privileged) |