ctr: add --hostname flag to create, run

Signed-off-by: Samuel Karp <me@samuelkarp.com>
This commit is contained in:
Samuel Karp 2022-06-20 15:11:28 -07:00
parent d59dcd0579
commit 6e53ffb105
No known key found for this signature in database
GPG Key ID: AAA3FE8A831FC087
2 changed files with 8 additions and 1 deletions

View File

@ -201,6 +201,10 @@ var (
Name: "rdt-class",
Usage: "name of the RDT class to associate the container with. Specifies a Class of Service (CLOS) for cache and memory bandwidth management.",
},
cli.StringFlag{
Name: "hostname",
Usage: "set the container's host name",
},
}
)

View File

@ -346,6 +346,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
if c := context.String("rdt-class"); c != "" {
opts = append(opts, oci.WithRdt(c, "", ""))
}
if hostname := context.String("hostname"); hostname != "" {
opts = append(opts, oci.WithHostname(hostname))
}
}
runtimeOpts, err := getRuntimeOptions(context)