pack: What does this error message mean

I am working on a custom build-pack but hitting this error when trying to run the built app:

❯ docker run --rm hello-k8s
Error: failed to launch: modify env: add layer env: readdirent: not a directory

Its not clear to me what the issue is 🤔

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

We can definitely differentiate between a file and a directory. Just pointing out (in case it wasn’t obvious) that it’s not possible for the buildpack to create an env file and an env directory in the same layer at the same time. We should always fail the build when an env file is created in a layer by mistake (and not generate an image at all).

If you’re interested in contributing, it would be great if the lifecycle did more validation on layers created by buildpacks.

env was a file from poetry, so why can’t it exist with an env folder technically?

Just to be totally clear, filesystems do not generally allow a file and a directory with the same name to co-exist in the same directory. I’m assuming you’re asking whether a file called env could exist instead of a directory called env in cases where the directory would otherwise be empty.

confirming that its technically not in the spec right?

You are correct: the spec does not explicitly say that creating <layers>/<layer>/env as a file will result in a build failure. But it does strongly suggest that <layers>/<layer>/env is reserved for a directory. We could certainly document that all files and directories mentioned are reserved for their intended purposes.

I think it would be confusing anyways to have env files supported from user next to reserved-name env folder…

I agree 😄