Merge pull request #2544 from kadisi/process_args
set args value of process if args is nil
This commit is contained in:
commit
830363acac
@ -57,12 +57,9 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
opts = append(opts, oci.WithSpecFromFile(context.String("config")))
|
||||
} else {
|
||||
opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
|
||||
}
|
||||
|
||||
opts = append(opts, oci.WithEnv(context.StringSlice("env")))
|
||||
opts = append(opts, withMounts(context))
|
||||
cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("label"))))
|
||||
cOpts = append(cOpts, containerd.WithRuntime(context.String("runtime"), nil))
|
||||
|
||||
if context.Bool("rootfs") {
|
||||
opts = append(opts, oci.WithRootFSPath(ref))
|
||||
} else {
|
||||
@ -107,6 +104,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
if context.Bool("net-host") {
|
||||
opts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf)
|
||||
}
|
||||
|
||||
joinNs := context.StringSlice("with-ns")
|
||||
for _, ns := range joinNs {
|
||||
parts := strings.Split(ns, ":")
|
||||
@ -124,6 +122,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
||||
if context.IsSet("gpus") {
|
||||
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.Int("gpus")), nvidia.WithAllCapabilities))
|
||||
}
|
||||
}
|
||||
|
||||
cOpts = append(cOpts, containerd.WithContainerLabels(commands.LabelArgs(context.StringSlice("label"))))
|
||||
cOpts = append(cOpts, containerd.WithRuntime(context.String("runtime"), nil))
|
||||
|
||||
var s specs.Spec
|
||||
spec = containerd.WithSpec(&s, opts...)
|
||||
|
@ -143,6 +143,7 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
||||
cmd = args
|
||||
}
|
||||
s.Process.Args = append(config.Entrypoint, cmd...)
|
||||
|
||||
cwd := config.WorkingDir
|
||||
if cwd == "" {
|
||||
cwd = "/"
|
||||
|
Loading…
Reference in New Issue
Block a user