From 744912b29a3c9ebf3304e385f525cd5d9efb5c23 Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Sun, 7 Aug 2022 14:28:36 -0400 Subject: [PATCH] add domainname spec entity add the domainname entity so that container runtimes can add special handling similar to hostname. The current workaround of adding a sysctl for kernel.domainname only works with rootful execution in most cases. This will allow for rootless execution. container runtimes will be able to add special handling as they do for hostname, using setdomainname to add the entry to /proc/sys/kernel/domainname. Signed-off-by: Charlie Doern --- config.md | 12 ++++++++++++ schema/config-schema.json | 3 +++ schema/test/config/good/spec-example.json | 1 + specs-go/config.go | 2 ++ 4 files changed, 18 insertions(+) diff --git a/config.md b/config.md index fe28de69d..6862fe4f3 100644 --- a/config.md +++ b/config.md @@ -355,6 +355,18 @@ For Windows based systems the user structure has the following fields: "hostname": "mrsdalloway" ``` +## Domainname + +* **`domainname`** (string, OPTIONAL) specifies the container's domainname as seen by processes running inside the container. + On Linux, for example, this will change the domainname in the [container](glossary.md#container-namespace) [UTS namespace][uts-namespace.7]. + Depending on your [namespace configuration](config-linux.md#namespaces), the container UTS namespace may be the [runtime](glossary.md#runtime-namespace) [UTS namespace][uts-namespace.7]. + +### Example + +```json +"domainname": "foobarbaz.test" +``` + ## Platform-specific configuration * **`linux`** (object, OPTIONAL) [Linux-specific configuration](config-linux.md). diff --git a/schema/config-schema.json b/schema/config-schema.json index a4d1274fc..cf66c6524 100644 --- a/schema/config-schema.json +++ b/schema/config-schema.json @@ -35,6 +35,9 @@ "hostname": { "type": "string" }, + "domainname": { + "type": "string" + }, "mounts": { "type": "array", "items": { diff --git a/schema/test/config/good/spec-example.json b/schema/test/config/good/spec-example.json index a784d1d74..83e91dcd2 100644 --- a/schema/test/config/good/spec-example.json +++ b/schema/test/config/good/spec-example.json @@ -63,6 +63,7 @@ "readonly": true }, "hostname": "slartibartfast", + "domainname": "foobarbaz.test", "mounts": [ { "destination": "/proc", diff --git a/specs-go/config.go b/specs-go/config.go index cf1b338c8..7e9122103 100644 --- a/specs-go/config.go +++ b/specs-go/config.go @@ -12,6 +12,8 @@ type Spec struct { Root *Root `json:"root,omitempty"` // Hostname configures the container's hostname. Hostname string `json:"hostname,omitempty"` + // Domainname configures the container's domainname. + Domainname string `json:"domainname,omitempty"` // Mounts configures additional mounts (on top of Root). Mounts []Mount `json:"mounts,omitempty"` // Hooks configures callbacks for container lifecycle events.