package pods import ( "log" "github.com/containers/podman/v4/pkg/bindings/containers" "github.com/containers/podman/v4/pkg/specgen" ) func CreateContainer() (string, error) { image := "docker.io/linuxserver/webtop" conn := Socket envmap := make(map[string]string) s := specgen.NewSpecGenerator(image, false) envmap["PASSWORD"] = "" envmap["TITLE"] = "Pod Terminal" envmap["PUID"] = "1000" envmap["GUID"] = "1000" s.Env = envmap createResponse, err := containers.CreateWithSpec(conn, s, nil) return createResponse.ID, err } func StartContainer(id string) error { return containers.Start(Socket, id, nil) } func DestroyContainer(id string) error { conn := Socket if err := containers.Kill(conn, id, nil); err != nil { log.Println(err) return err } if _, err := containers.Remove(conn, id, nil); err != nil { log.Println(err) return err } return nil } func GetContainerIP(id string) (string, error) { conn := Socket container, err := containers.Inspect(conn, id, nil) if err != nil { log.Println(err) return "", err } ip := container.NetworkSettings.IPAddress return ip, err }