Documentation
¶
Index ¶
- type Shim
- func (s *Shim) Attach(attachStdin, attachStdout, attachStderr bool) error
- func (s *Shim) CopyLogs(stdout io.Writer, stderr io.Writer, withTimestamps bool) error
- func (s *Shim) Create(rootDir string) error
- func (s *Shim) Delete() error
- func (s *Shim) DeleteContainer() error
- func (s *Shim) GetState() (*yacs.YacsState, error)
- func (s *Shim) OpenStreams() (*os.File, *os.File, *os.File, error)
- func (s *Shim) Recreate(rootDir string) error
- func (s *Shim) Slirp4netnsApiSocketPath() string
- func (s *Shim) Slirp4netnsPidFilePath() string
- func (s *Shim) StartContainer() error
- func (s *Shim) StopContainer() error
- func (s *Shim) Terminate() error
- type ShimOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Shim ¶
type Shim struct { BaseDir string Container *container.Container Opts ShimOpts SocketPath string State *yacs.YacsState // contains filtered or unexported fields }
Shim represents an instance of the `yacs` shim.
func Load ¶
Load attempts to load a shim configuration from disk. It returns a new shim instance when it succeeds or an error when there is a problem.
func (*Shim) CopyLogs ¶
CopyLogs copies all the container logs stored by the shim to the provided writers. Note that this method does NOT use the shim's HTTP API. It reads the container log file directly.
func (*Shim) Create ¶
Create starts a shim process, which will also create a container by invoking an OCI runtime.
func (*Shim) Delete ¶
Delete deletes a container that is not running, otherwise an error will be returned. If the container is not running and not stopped, the shim is terminated first.
All the container files should be deleted as a result of a call to this method and the container will not exist anymore.
func (*Shim) DeleteContainer ¶
DeleteContainer tells the shim to delete the container.
func (*Shim) OpenStreams ¶
OpenStreams opens and returns the stdio streams of the container.
func (*Shim) Recreate ¶
Recreate stops a container if it is running and then re-create a new container. If the container is already stopped, we only re-create the container.
func (*Shim) Slirp4netnsApiSocketPath ¶
Slirp4netnsApiSocketPath returns the path to the API socket used to communicate with the slirp4netns process.
func (*Shim) Slirp4netnsPidFilePath ¶
Slirp4netnsPidFilePath returns the path to the file where the slirp4netns process ID should be written when it is started.
func (*Shim) StartContainer ¶
StartContainer tells the shim to start a container that was previously created.
func (*Shim) StopContainer ¶
StopContainer tells the shim to stop the container by sending a SIGTERM signal first and a SIGKILL if the first signal didn't stop the container.
func (*Shim) Terminate ¶
Terminate stops the shim if the container is stopped, otherwise an error is returned.
Stopping the shim is performed in two steps: (1) delete the container, and (2) run some clean-up tasks like unmounting the root filesystem, stopping slirp4netns and terminating the shim process.
Once this is done, we persist the final shim state on disk so that other Yaman commands can read and display information until the container is actually deleted. This is one of the main differences with the `Destroy()` method: the shim state is still available.