docker 容器上编译 go 程序提示找不到文件问题
发表于:2024-09-30 作者:千家信息网编辑
千家信息网最后更新 2024年09月30日,dockerfile[root@SZB-L0010091 zxg]# cat DockerfileFROM scratchCOPY webdemo /EXPOSE 9999CMD ["/webdemo
千家信息网最后更新 2024年09月30日docker 容器上编译 go 程序提示找不到文件问题
dockerfile
[root@SZB-L0010091 zxg]# cat DockerfileFROM scratchCOPY webdemo /EXPOSE 9999CMD ["/webdemo"]
docker run 报错信息:
[root@zxg]# docker run --rm -it -p 9999: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
解决办法:增加-tags netgo选项编译
GOOS=linux GOARCH=amd64 go build -tags netgo -o rollingupdate${TAG} main.go
总结
以上所述是小编给大家介绍的好的docker 容器上编译 go 程序无法运行提示找不到文件问题,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
上编
容器
文件
程序
问题
提示
信息
办法
疑问
网站
帮助
支持
编译
运行
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
威海软件开发培训
浦东新区诚信软件开发教育
彩票软件开发哪一些
有关军队网络安全
监控画面静止软件开发
美国服务器100m
软件开发过程中的技术风险
网络安全宣传工作通知
游戏 模型 软件开发
服务器需要多大的内存条
目前主流无线网络技术
oecd数据库中文翻译
池州进销存软件开发平台
电信网络安全技术与应用
什么是网络安全密匙
数据库经典模板下载地址
深圳市百亿互联网科技有限公司
sr258服务器u盘启动
部门 数据库设计
数据库的便利
云服务器保障条款
广东云服务器
海康如何关闭ntp服务器
穿越火线哪个服务器有生化剑客
观看网络安全小视频
防沉迷网络安全知识幼儿园
提示的数据库未安装
贵州网络安全企业排名
荣成学院纸本数目数据库
合工大数据库技术作业