buildkit: open /.docker/.token_seed: permission denied

While testing out the 0.8.1 rootless image, I encountered the following build error:

error: failed to solve: rpc error: code = Unknown desc = open /.docker/.token_seed: permission denied

From looking at the source code it appears that the token seed file logic is only checking against syscall.EPERM and not syscall.EACCES, so a permission failure is fatal. You should switch to os.IsPermission(err) instead of using errors.Is(err, syscall.EPERM), since this will account for both syscall.EPERM and syscall.EACCES.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Faced the same issue so just added rw permission to the required files.

chmod 666 .token_seed .token_seed.lock

Not sure what’s the impact of this but solved my error for now.

I had the same error, though for me this occurs when accessing an image directly from docker hub using ‘FROM …’. Not sure it has anything to do with this, and the error disappears after i manually run a ‘docker pull …’. It is not limited to the image used here (alpine) but for everything. Is this happening for anybody else? I am on macOS Big Sur if that matters.

@Cartmanishere 666 means that anyone on your computer could read and write to that file. On my machine the permissions are currently 600

-rw-------  1 root  staff  74 Dec 24 11:53 /Users/spuder/.docker/.token_seed

A safer option would be 660

chmod 660 .token_seed .token_seed.lock

I got same error. For now docker pull ... helped but I’m not sure yet if error is gone for good.

In my Dockerfile, the /.docker folder was created by root. (It was really created as a side effect of a COPY instruction, which ignores the contextual uid/gid, unlike RUN.) Consequently, uid 1000 did not have write permission to the folder, so attempting to create the /.docker/.token_seed file failed.