github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/nsenter.go (about)

     1  // Copyright (c) 2016 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  //
     5  
     6  package virtcontainers
     7  
     8  // nsenter is a spawner implementation for the nsenter util-linux command.
     9  type nsenter struct {
    10  	ContConfig ContainerConfig
    11  }
    12  
    13  const (
    14  	// NsenterCmd is the command used to start nsenter.
    15  	nsenterCmd = "nsenter"
    16  )
    17  
    18  // formatArgs is the spawner command formatting implementation for nsenter.
    19  func (n *nsenter) formatArgs(args []string) ([]string, error) {
    20  	var newArgs []string
    21  	pid := "-1"
    22  
    23  	// TODO: Retrieve container PID from container ID
    24  
    25  	newArgs = append(newArgs, nsenterCmd+" --target "+pid+" --mount --uts --ipc --net --pid")
    26  	newArgs = append(newArgs, args...)
    27  
    28  	return newArgs, nil
    29  }