Documentation ¶
Index ¶
- func RegisterAutoRuntime(r Runtime)
- type Container
- type ContainerConfig
- type File
- type LivenessCheck
- type Logger
- type Option
- func WithCmd(in []string) Option
- func WithEntrypoint(in string) Option
- func WithEnv(in []string) Option
- func WithExposePort(port string) Option
- func WithFileUpload(f File) Option
- func WithLivenessCheck(lc LivenessCheck) Option
- func WithLogger(in Logger) Option
- func WithRuntime(in Runtime) Option
- func WithUlimit(in []Ulimit) Option
- type Runtime
- type Ulimit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterAutoRuntime ¶
func RegisterAutoRuntime(r Runtime)
RegisterAutoRuntime allows a runtime to register itself for auto-selection of a runtime, when one isn't explicitly specified.
Types ¶
type Container ¶
type Container interface { // Context releases resources associated with the container. Close(context.Context) error // Address returns the IP and port of the running container. Address() string // AddressForPort returns the address for the specified port, // or an error, if the port was not exposed. AddressForPort(string) (string, error) // StreamLogs asynchronously streams logs from the // running container to the writer. The writer must // be safe for concurrent use. // If the context is cancelled after logging has been set up, // it has no effect. Use Close to stop logging. // This function is called automatically on the runtimes // configured logger, so there is no need to explicitly call this. StreamLogs(context.Context, io.Writer) error }
Container represents a running container.
type ContainerConfig ¶
type ContainerConfig struct { Repo string Tag string Port string // Optional Env []string Entrypoint *string Cmd []string Ulimits []Ulimit Files []File ExtraPorts []string }
ContainerConfig is used by runtimes to start containers.
type LivenessCheck ¶ added in v0.2.0
LivenessCheck is a type used to check the successful startup of a container.
type Logger ¶
type Logger interface { Trace(msg string, fields ...map[string]interface{}) Debug(msg string, fields ...map[string]interface{}) Info(msg string, fields ...map[string]interface{}) Warn(msg string, fields ...map[string]interface{}) Error(msg string, fields ...map[string]interface{}) }
Logger must be implemented to log events. See https://logur.dev/logur for some adapters for popular logging libraries.
type Option ¶ added in v0.4.0
type Option func(*config)
Option configures the configuration of the started container.
func WithEntrypoint ¶
WithEntrypoint configures the entrypoint of the container.
func WithExposePort ¶ added in v0.4.0
WithExposePort adds extra ports that should be exposed from the started container.
func WithFileUpload ¶ added in v0.4.0
WithFileUpload writes the content of the reader to the provided path inside the container, before starting the container. This can be specified multiple times.
func WithLivenessCheck ¶ added in v0.2.0
func WithLivenessCheck(lc LivenessCheck) Option
WithLivenessCheck defines a function to call repeatedly until it does not error, to ascertain the successful startup of the container. The function will be retried for 10 seconds, and if it does not return a non-nil error before that time, the last error will be returned.
func WithLogger ¶
WithLogger configures the logger of the container. The containers logs will be logged at Info level to this logger. Some errors during closing may also be logged at Error level.
func WithRuntime ¶
WithRuntime configures the Runtime to use to launch the container. By default, the auto runtime is used.
func WithUlimit ¶
WithUlimit configures the ulimits of the container.
Directories ¶
Path | Synopsis |
---|---|
runtimes
|
|
podman/iopodman
Podman Service Interface and API description.
|
Podman Service Interface and API description. |