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")))
|
opts = append(opts, oci.WithSpecFromFile(context.String("config")))
|
||||||
} else {
|
} else {
|
||||||
opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
|
opts = append(opts, oci.WithDefaultSpec(), oci.WithDefaultUnixDevices)
|
||||||
}
|
|
||||||
|
|
||||||
opts = append(opts, oci.WithEnv(context.StringSlice("env")))
|
opts = append(opts, oci.WithEnv(context.StringSlice("env")))
|
||||||
opts = append(opts, withMounts(context))
|
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") {
|
if context.Bool("rootfs") {
|
||||||
opts = append(opts, oci.WithRootFSPath(ref))
|
opts = append(opts, oci.WithRootFSPath(ref))
|
||||||
} else {
|
} else {
|
||||||
@ -107,6 +104,7 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
if context.Bool("net-host") {
|
if context.Bool("net-host") {
|
||||||
opts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf)
|
opts = append(opts, oci.WithHostNamespace(specs.NetworkNamespace), oci.WithHostHostsFile, oci.WithHostResolvconf)
|
||||||
}
|
}
|
||||||
|
|
||||||
joinNs := context.StringSlice("with-ns")
|
joinNs := context.StringSlice("with-ns")
|
||||||
for _, ns := range joinNs {
|
for _, ns := range joinNs {
|
||||||
parts := strings.Split(ns, ":")
|
parts := strings.Split(ns, ":")
|
||||||
@ -124,6 +122,10 @@ func NewContainer(ctx gocontext.Context, client *containerd.Client, context *cli
|
|||||||
if context.IsSet("gpus") {
|
if context.IsSet("gpus") {
|
||||||
opts = append(opts, nvidia.WithGPUs(nvidia.WithDevices(context.Int("gpus")), nvidia.WithAllCapabilities))
|
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
|
var s specs.Spec
|
||||||
spec = containerd.WithSpec(&s, opts...)
|
spec = containerd.WithSpec(&s, opts...)
|
||||||
|
@ -143,6 +143,7 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
|
|||||||
cmd = args
|
cmd = args
|
||||||
}
|
}
|
||||||
s.Process.Args = append(config.Entrypoint, cmd...)
|
s.Process.Args = append(config.Entrypoint, cmd...)
|
||||||
|
|
||||||
cwd := config.WorkingDir
|
cwd := config.WorkingDir
|
||||||
if cwd == "" {
|
if cwd == "" {
|
||||||
cwd = "/"
|
cwd = "/"
|
||||||
|
Loading…
Reference in New Issue
Block a user