Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Problem with file not found when compiling go program on docker container

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Dockerfile

[root@SZB-L0010091 zxg] # cat DockerfileFROM scratchCOPY webdemo / EXPOSE 9999CMD ["/ webdemo"]

Docker run error message:

[root@zxg] # docker run-- rm-it-p 9999 web:1.0panic: standard_init_linux.go:178: exec user process caused "no such file or directory" [recovered] panic: standard_init_linux.go:178: exec user process caused "no such file or directory" goroutine 1 [running, locked to thread]: panic (0x6f2340) 0xc420132620) / usr/lib/golang/src/runtime/panic.go:500 + 0x1a1github.com/urfave/cli.HandleAction.func1 (0xc420091748) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/urfave/cli/app.go:478 + 0x247panic (0x6f2340, 0xc420132620) / usr/lib/golang/src/runtime/panic.go:458 + 0x243github.com/opencontainers/runc/libcontainer. (* LinuxFactory) .StartInitialization. func1 (0xc420091198, 0xc42001e050 0xc420091238) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux.go:259 + 0x18fgithub.com/opencontainers/runc/libcontainer. (* LinuxFactory) .Startinitialization (0xc42004efa0, 0xaab9c0, 0xc420132620) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/factory_linux.go:277 + 0x353main.glob..func8 (0xc4200ba3c0, 0x0) 0x0) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/main_unix.go:26 + 0x66reflect.Value.call (0x6dd0c0, 0x768ec8, 0x13, 0x73b509, 0x4, 0xc420091708, 0x1, 0x1, 0x4d17a8, 0x731360,...) / usr/lib/golang/src/reflect/value.go:434 + 0x5c8reflect.Value.Call (0x6dd0c0, 0x768ec8, 0x13, 0xc420091708, 0x1, 0x1, 0xac1700, 0xc4200916e8, 0x4da786) / usr/lib/golang/src/reflect/value.go:302 + 0xa4github.com/urfave/cli.HandleAction (0x6dd0c0, 0x768ec8, 0xc4200ba3c0, 0x0) 0x0) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/urfave/cli/app.go:487 + 0x1e0github.com/urfave/cli.Command.Run (0x73b6d5, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x74cc8a, 0x51, 0x0,...) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/urfave/cli/command.go:191 + 0xc3bgithub.com/urfave/cli. (* App) .Run (0xc4200cc000, 0xc420064060, 0x2 0x2, 0x0, 0x0) / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/Godeps/_workspace/src/github.com/urfave/cli/app.go:240 + 0x611main.main () / builddir/build/BUILD/docker-1398f249013601ab999d286910664d70fd1329a2/runc-f5721697226d42d9efeea37fa3a7eb1d208fa1a2/main.go:137 + 0xbd6

Solution: add the-tags netgo option to compile

GOOS=linux GOARCH=amd64 go build-tags netgo-o rollingupdate$ {TAG} main.go

Summary

The above is the editor to introduce to you the good docker container compiler go program can not run prompt can not find the file problem, I hope to help you, if you have any questions, please leave me a message, the editor will reply to you in time. Thank you very much for your support to the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report