Merge pull request #7082 from samuelkarp/ctr-hostname
ctr: add --hostname flag to create, run
This commit is contained in:
		@@ -201,6 +201,10 @@ var (
 | 
				
			|||||||
			Name:  "rdt-class",
 | 
								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.",
 | 
								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",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -106,7 +106,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
 | 
				
			|||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		var (
 | 
							var (
 | 
				
			||||||
			ref = context.Args().First()
 | 
								ref = context.Args().First()
 | 
				
			||||||
			//for container's id is Args[1]
 | 
								// for container's id is Args[1]
 | 
				
			||||||
			args = context.Args()[2:]
 | 
								args = context.Args()[2:]
 | 
				
			||||||
		)
 | 
							)
 | 
				
			||||||
		opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
 | 
							opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
 | 
				
			||||||
@@ -346,6 +346,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
 | 
				
			|||||||
		if c := context.String("rdt-class"); c != "" {
 | 
							if c := context.String("rdt-class"); c != "" {
 | 
				
			||||||
			opts = append(opts, oci.WithRdt(c, "", ""))
 | 
								opts = append(opts, oci.WithRdt(c, "", ""))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if hostname := context.String("hostname"); hostname != "" {
 | 
				
			||||||
 | 
								opts = append(opts, oci.WithHostname(hostname))
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	runtimeOpts, err := getRuntimeOptions(context)
 | 
						runtimeOpts, err := getRuntimeOptions(context)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user