INNER CODE UNIT · Go

generateSpec

container2wasm/container2wasm · cmd/create-spec/main.go:317

func generateSpec(config ocispec.Image, rootfs string) (_ *specs.Spec, err error) {
	ic := config.Config
	ctdCtx := ctdnamespaces.WithNamespace(context.TODO(), "default")
	p := "linux/riscv64"
	if config.Architecture == "amd64" {
		p = "linux/amd64"
	}
	s, err := ctdoci.GenerateSpecWithPlatform(ctdCtx, nil, p, &ctdcontainers.Container{},
		ctdoci.WithHostNamespace(specs.NetworkNamespace),
		ctdoci.WithoutRunMount,
		ctdoci.WithDefaultPathEnv,
		ctdoci.WithEnv(ic.Env),
		ctdoci.WithTTY,           // TODO: make it configurable
		ctdoci.WithNewPrivileges, // TODO: make it configurable
	)
	if err != nil {
		return nil, fmt.Errorf("failed to generate spec: %w", err)
	}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…