container

package
v13.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package container provides methods for checking container engine info

Index

Examples

Constants

View Source
const (
	DOCKER       = "docker"       // Docker (Moby)
	PODMAN       = "podman"       // Podman
	LXC          = "lxc"          // LXC
	YANDEX       = "yandex"       // Yandex Serverless
	DOCKER_RUNSC = "docker+runsc" // Docker (Moby) + runsc (gVisor)
)

Variables

This section is empty.

Functions

func GetEngine

func GetEngine() string

GetEngine returns container engine name if used

Example
fmt.Printf("Container engine: %s\n", GetEngine())
Output:

func IsContainer

func IsContainer() bool

IsContainer returns true if we are inside container

Example
if !IsContainer() {
	fmt.Println("It's not containerized")
} else {
	fmt.Printf("It's containerized using %s engine\n", GetEngine())
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL