container

package
v12.120.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

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
)

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 added in v12.108.0

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