mirror of https://github.com/1Panel-dev/1Panel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
648 B
33 lines
648 B
2 years ago
|
package service
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"io/ioutil"
|
||
|
"strings"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestDocker(t *testing.T) {
|
||
|
file, err := ioutil.ReadFile("/opt/1Panel/docker/daemon.json")
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
var conf daemonJsonItem
|
||
|
deamonMap := make(map[string]interface{})
|
||
|
if err := json.Unmarshal(file, &deamonMap); err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
arr, err := json.Marshal(deamonMap)
|
||
|
if err != nil {
|
||
|
fmt.Println(err)
|
||
|
}
|
||
|
_ = json.Unmarshal(arr, &conf)
|
||
|
|
||
|
for _, opt := range conf.ExecOpts {
|
||
|
if strings.HasPrefix(opt, "native.cgroupdriver=") {
|
||
|
fmt.Println(strings.ReplaceAll(opt, "native.cgroupdriver=", ""))
|
||
|
}
|
||
|
}
|
||
|
}
|