blob: 3128a8ecdd5983fffe0a72fe35c893cd106ccdb7 [file] [log] [blame]
Maros Ondrejicka11a03e92022-12-01 09:56:37 +01001package main
2
3import (
4 "fmt"
5
6 "github.com/edwarnicke/exechelper"
7)
8
9type Container struct {
10 name string
11}
12
13func (c *Container) run() error {
14 if c.name == "" {
15 return fmt.Errorf("create volume failed: container name is blank")
16 }
17
18 exechelper.Run(fmt.Sprintf("mkdir -p /tmp/%s/sync", c.name))
19 syncPath := fmt.Sprintf("-v /tmp/%s/sync:/tmp/sync", c.name)
20 cmd := "docker run --cap-add=all -d --privileged --network host --rm "
21 cmd += syncPath
22 cmd += " --name " + c.name + " hs-test/vpp"
23 fmt.Println(cmd)
24 err := exechelper.Run(cmd)
25 if err != nil {
26 return fmt.Errorf("create volume failed: %s", err)
27 }
28
29 return nil
30}
31