mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 17:17:13 +08:00
feat(容器): 支持自定义 sock
This commit is contained in:
@@ -17,8 +17,11 @@ type Container struct {
|
||||
client *client.Client
|
||||
}
|
||||
|
||||
func NewContainer() *Container {
|
||||
cli, _ := client.NewClientWithOpts(client.FromEnv, client.WithHost("unix:///var/run/podman.sock"), client.WithAPIVersionNegotiation())
|
||||
func NewContainer(sock string) *Container {
|
||||
if sock == "" {
|
||||
sock = "/run/podman/podman.sock"
|
||||
}
|
||||
cli, _ := client.NewClientWithOpts(client.WithHost("unix://"+sock), client.WithAPIVersionNegotiation())
|
||||
return &Container{
|
||||
client: cli,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user