Volume permission denied with default buildpack in Go

Wanted to flag a possible issue where volumes deny permission using the default Go build pack (no Dockerfile).

After building with a Dockerfile (like the example go app), the issue is solved and volumes work as expected.

I imagine this could be a bump in the road for new users testing out the platform for the first time.

@patmood Welcome, and thanks for reporting this :smiley:

Could you clarify that a bit more? You deployed an app once with a builder, tried to read(?) or write(?) to the volume and got an error?

And this error went away after a subsequent deployment with a Dockerfile instead of the buildpack?

If you could post a few of the outputs or errors you got it would be really helpful, thanks!

That’s exactly right. Go app with no Dockerfile and a volume mounted at /data

Relevant code is:

	_, err := os.OpenFile("/data/db.sqlite", os.O_CREATE, 0666)
	if err != nil {
		log.Fatal(err)
	}

The error in the logs was: open /data/db.sqlite: permission denied

The auto generated build section in fly.toml was:

[build]
  builder = "paketobuildpacks/builder:base"
  buildpacks = ["gcr.io/paketo-buildpacks/go"]

After reading the other threads here, I removed that build section and added a Dockerfile (without changing any app code) and that fixed it. My Dockerfile is basically identical to the example app

Thanks. I suspect it was related to Can't create Sqlite database in mounted volume - #6 by kurt

The builders usually run with different users, so they might need a permissions setup to get going.

1 Like