Use MAC M1 build image to run on Linux and report standard_ init_ linux.go:219: exec user process caused: exec format error
The main reason for this problem is that golang compilation cannot cross platform, that is, different systems or different CPU cores will cause this error. The golang code compiled under Linux arm cannot be run under Linux x86; Similarly, the image of a project with golang code cannot cross platform. The solution is very simple. When building, add the — platform Linux/AMD64 parameter
docker build --platform linux/amd64 -t tag .