package main import ( "context" "os" "github.com/moby/buildkit/client/llb" ) func createLLBState() llb.State { base := llb.Image("docker.io/library/alpine") base = base. File(llb.Mkdir("/tmp/dir", 0755)). File(llb.Copy(llb.Local("context"), "README.md", "/tmp/dir/README.md")). File(llb.Copy(llb.Local("context"), "README.md", "README.md")) anotbase := llb.Image("docker.io/library/alpine:3.6") anotbase = anotbase.Run(llb.Shlexf("cp -a /tmp/dir/%s /tmp/dir/%s", "README.md", "README.copy.md")). AddMount("/", base) return anotbase.Run(llb.Args([]string{"/bin/sh"})).Root() } func main() { dt, err := createLLBState().Marshal(context.TODO(), llb.LinuxAmd64) if err != nil { panic(err) } llb.WriteTo(dt, os.Stdout) } # go run main.go | buildctl debug dumb-llb | jq