I have the following example:
func foo() {
ctx := context.Background()
client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr))
if err != nil {
log.Println(err)
return
}
defer client.Close()
contents, err := client.Container().
From("alpine:latest").
WithMountedDirectory("/host", client.Host().Directory(".")).
WithExec([]string{"/bin/sh", "-c", `echo foo > /host/a`}).
Stdout(ctx)
if err != nil {
log.Println(err)
return
}
fmt.Println(contents)
}
But I don't see a file appear in working directory. If I run the ls command in /host dir then I can see all files/directories. What could be wrong?