Home  >  Article  >  Backend Development  >  Unable to successfully build any golang docker image, permission denied

Unable to successfully build any golang docker image, permission denied

WBOY
WBOYforward
2024-02-10 14:21:08889browse

无法成功构建任何 golang docker 镜像,权限被拒绝

php editor Xigua found that some developers encountered a common problem when building golang docker images: "Unable to successfully build any golang docker image, permission denied." This problem may prevent developers from successfully building images and affect the development process. In this article, we will explore the causes of this problem and provide solutions to help developers build golang docker images smoothly.

Question content

I've been trying to build a golang docker image for my application, but I can't get any images to build:

I have tried these two dockerfiles:

65bd4dbf21c6

and

65bd4dbf21d3

Error (different binary name, but same error):

65bd4dbf21d8

I tried setting the execute bit on the outputted file but it still doesn't work. I was able to use the exact same dockerfile before, but now they don't seem to want to work.

Any help is appreciated, thank you

I have tried chowning the build binary without success. I've tried different dockerifles without success.

It was fine 3 days ago, but now I don’t want to work. Also tried docker system prune --all, no luck I searched for other answers but nothing worked.

Solution

This is because I built the project's root folder inside the container, not the /cmd folder where the main file is. Make sure to chmod x the output files in the container and make sure the correct files are built.

/face covering

The above is the detailed content of Unable to successfully build any golang docker image, permission denied. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:stackoverflow.com. If there is any infringement, please contact admin@php.cn delete