Skip to content

seoyhaein/podbridge

Repository files navigation

podbridge

Go Reference Build Status CodeFactor

package main

import (
	"context"
	"fmt"

	pbr "github.com/seoyhaein/podbridge"
)

func main() {
	ctx, err := pbr.NewConnectionLinux(context.Background())
	if err != nil {
		panic(err)
	}
	// spec 만들기
	conSpec := pbr.NewSpec()
	conSpec.SetImage("docker.io/library/test07")

	f := func(spec pbr.SpecGen) pbr.SpecGen {
		spec.Name = "container-tester01"
		spec.Terminal = true
		return spec
	}
	conSpec.SetOther(f)
	// 해당 이미지에 해당 shell script 가 있다.
	conSpec.SetHealthChecker("CMD-SHELL /app/healthcheck/healthcheck.sh", "2s", 1, "30s", "1s")

	// container 만들기
	r := pbr.CreateContainer(ctx, conSpec)
	fmt.Println("container Id is :", r.ID)
	result := r.RunT(ctx, "1s")

	v := int(result)
	fmt.Println(v)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published