6 "github.com/edwarnicke/exechelper"
14 type Container struct {
19 func (c *Container) run() error {
21 return fmt.Errorf("create volume failed: container name is blank")
24 exechelper.Run(fmt.Sprintf("mkdir -p /tmp/%s/sync", c.name))
25 syncPath := fmt.Sprintf("-v /tmp/%s/sync:/tmp/sync", c.name)
26 cmd := "docker run --cap-add=all -d --privileged --network host --rm "
29 cmd += " --name " + c.name + " hs-test/vpp"
31 err := exechelper.Run(cmd)
33 return fmt.Errorf("create volume failed: %s", err)
39 func (c *Container) addVolume(name string, containerPath string) {
40 c.volumes = append(c.volumes, &Volume{name, containerPath})
43 func (c *Container) getVolumes() string {
46 if len(c.volumes) > 0 {
47 for _, volume := range c.volumes {
48 dockerOption += fmt.Sprintf(" -v %s:%s", volume.name, volume.path)
55 func (c *Container) stop() error {
56 return exechelper.Run("docker stop " + c.name)