update documentations

This commit is contained in:
criyle 2020-02-21 02:18:05 -05:00
parent 33a7b2b603
commit 5b50e9db4d
3 changed files with 29 additions and 2 deletions

View File

@ -122,6 +122,33 @@ Container / Host Communication Protocol (single thread):
Any socket related error will cause the container exit (with all process inside container)
### Pre-forked Container Environment
Container restricted environment is accessed though RPC interface defined by above protocol
Provides:
- File access
- Open: create / access files
- Delete: remove file
- Management
- Ping: alive check
- Reset: remove temporary files
- Destroy: destroy the container environment
- Run program
- Execve: execute program with given parameters
``` go
type Environment interface {
Ping() error
Open([]OpenCmd) ([]*os.File, error)
Delete(p string) error
Reset() error
Execve(context.Context, ExecveParam) <-chan types.Result
Destroy() error
}
```
## Packages (/pkg)
- seccomp: provides seccomp type definition

View File

@ -45,7 +45,7 @@ func Init() (err error) {
// limit container resource usage
runtime.GOMAXPROCS(containerMaxProc)
// new_master shared the socket at fd 3 (marked close_exec)
// new_container environment shared the socket at fd 3 (marked close_exec)
const defaultFd = 3
soc, err := unixsocket.NewSocket(defaultFd)
if err != nil {

View File

@ -56,7 +56,7 @@ type Environment interface {
// container manages single pre-forked container environment
type container struct {
pid int // underlying container init pid
socket *unixsocket.Socket // master - container communication
socket *unixsocket.Socket // host - container communication
mu sync.Mutex // lock to avoid race condition
}