open /Users/[user]/.docker/buildx/current: permission denied on macbook?

huangapple go评论67阅读模式
英文:

open /Users/[user]/.docker/buildx/current: permission denied on macbook?

问题

我运行了命令docker compose up --build,它正常运行,然后我尝试以sudo运行它一次。

自那以后,如果我不使用sudo,我会得到这个错误:

open /Users/[user]/.docker/buildx/current: permission denied

显然,有一个修复方法,即在运行命令之前设置DOCKER_BUILDKIT=0,但我真的想要一个干净的解决方案。

我已经尝试重新启动我的笔记本电脑,删除Docker桌面(使用我在Stack Overflow上找到的卸载脚本,显然没有完全卸载一切)。但我仍然得到这个错误。

英文:

I ran the command docker compose up --build and it ran normally, then I tried to run it with sudo once.

and since then if I don't use sudo I get this error:

open /Users/[user]/.docker/buildx/current: permission denied

Theres apparently a fix by setting DOCKER_BUILDKIT=0 before the command but I really want a clean solution.

I have tried restarting my laptop, deleting docker desktop (using an uninstall script I found on stack overflow that apprently didn't uninstall everything). And I still get that error

答案1

得分: 48

sudo chown -R $(whoami) ~/.docker

英文:

As comment by @emadpres, I am sharing here for mac user with auto detecting user:

sudo chown -R $(whoami) ~/.docker

答案2

得分: 8

如@lane.maxwell所评论的,您需要更新~/.docker目录的所有者为您的用户名,使用以下命令:sudo chown -R [user] ~/.docker

(-R: 递归执行更改以包括子目录)

英文:

As commented by @lane.maxwell, you need to update the owner of ~/.docker directory to your username, using: sudo chown -R [user] ~/.docker

(-R: perform the change recursively to subdirectories)

huangapple
  • 本文由 发表于 2023年3月9日 23:42:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75686903.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定