Closed blacktop closed 8 years ago
I am using:
The following code produces the following error:
// CopyToVolume copies samples into Malice volume func (client *Docker) CopyToVolume(file persist.File) { name := "copy2volume" image := "busybox" cmd := strslice.StrSlice{"sh", "-c", "while true; do echo 'Hit CTRL+C'; sleep 1; done"} binds := []string{"malice:/malice:rw"} volSavePath := filepath.Join("/malice/samples", file.SHA256) if client.Ping() { container, err := client.StartContainer(cmd, name, image, false, binds, nil, nil, nil) if err != nil { log.Fatal(err) } // If file doesn't already exists copy into volume // stat, err := client.Client.ContainerStatPath(context.Background(), container.ID, volSavePath) // if err != nil { // log.Fatal(err) // } // log.Info(stat) dat, err := ioutil.ReadFile(file.Path) if err != nil { log.Fatal(err) } copyOptions := types.CopyToContainerOptions{AllowOverwriteDirWithFile: false} er.CheckError(client.Client.CopyToContainer( context.Background(), container.ID, volSavePath, bytes.NewReader(dat), copyOptions, )) client.RemoveContainer(container, true, true, true) } }
ERRO[0008] "Error response from daemon: lstat /var/lib/docker/aufs/mnt/8baff3cc48493dc83e9bc84e74731ed17ed985d4ece8455698d279c712545b0e/malice/samples/0d1228498210c576a3c0f70816d43c22e4539a170555eaf27f9ed37b6c3ae382: no such file or directory" goroutine 1 [running]: github.com/maliceio/malice/malice/errors.CheckErrorWithMessage(0x536c028, 0xc820368770, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1) /Users/blacktop/src/go/src/github.com/maliceio/malice/malice/errors/errors.go:24 +0x96 github.com/maliceio/malice/malice/errors.CheckError(0x536c028, 0xc820368770, 0xc820010678) /Users/blacktop/src/go/src/github.com/maliceio/malice/malice/errors/errors.go:12 +0x48 github.com/maliceio/malice/malice/maldocker.(*Docker).CopyToVolume(0xc82036b230, 0x7fff5fbff5da, 0x40, 0x7fff5fbff5cd, 0x4d, 0xc820380488, 0x8, 0xc8203d9760, 0x20, 0xc820391b00, ...) /Users/blacktop/src/go/src/github.com/maliceio/malice/malice/maldocker/volume.go:76 +0x7ad github.com/maliceio/malice/commands.cmdScan(0x7fff5fbff5cd, 0x4d, 0x0, 0x0, 0x0) /Users/blacktop/src/go/src/github.com/maliceio/malice/commands/scan.go:63 +0x888 github.com/maliceio/malice/commands.glob.func1(0xc820318640, 0x0, 0x0) /Users/blacktop/src/go/src/github.com/maliceio/malice/commands/commands.go:25 +0xd3 reflect.Value.call(0x45d4ec0, 0x490c1e8, 0x13, 0x47b6e78, 0x4, 0xc820593460, 0x1, 0x1, 0x0, 0x0, ...) /usr/local/opt/go/libexec/src/reflect/value.go:435 +0x120d reflect.Value.Call(0x45d4ec0, 0x490c1e8, 0x13, 0xc820593460, 0x1, 0x1, 0x0, 0x0, 0x0) /usr/local/opt/go/libexec/src/reflect/value.go:303 +0xb1 github.com/maliceio/malice/vendor/github.com/urfave/cli.HandleAction(0x45d4ec0, 0x490c1e8, 0xc820318640, 0x0, 0x0) /Users/blacktop/src/go/src/github.com/maliceio/malice/vendor/github.com/urfave/cli/app.go:480 +0x2ee github.com/maliceio/malice/vendor/github.com/urfave/cli.Command.Run(0x47bed88, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x47ca510, 0xb, 0x0, ...) /Users/blacktop/src/go/src/github.com/maliceio/malice/vendor/github.com/urfave/cli/command.go:186 +0x1301 github.com/maliceio/malice/vendor/github.com/urfave/cli.(*App).Run(0xc8202f6a80, 0xc82000a240, 0x3, 0x3, 0x0, 0x0) /Users/blacktop/src/go/src/github.com/maliceio/malice/vendor/github.com/urfave/cli/app.go:236 +0xa9c
Any help would be greatly appreciated. I banged my head against it for an hour before posting the issue.
Thank you.
It was because the parent dir didn't exist 😞 my apologies.
I am using:
The following code produces the following error:
Any help would be greatly appreciated. I banged my head against it for an hour before posting the issue.
Thank you.