standard_init_linux.go:211: exec user process caused "no such file or directory"
情景自治docker base image启动时出现”standard_init_linux.go:211: exec user process caused "no such file or directory"错误。解决由于创建的base image里面只有一个c编译后的执行文件,但是利用docker build后执行时老出现上述错误。后来发现,在利用gcc编译时,需要添加-stati...
·
情景
自治docker base image启动时出现”standard_init_linux.go:211: exec user process caused "no such file or directory"错误。
解决
由于创建的base image里面只有一个c编译后的执行文件,但是利用docker build后执行时老出现上述错误。
后来发现,在利用gcc编译时,需要添加-static参数,来生成执行文件,这样docker run则不会再出现上述问题。
gcc static参数
当gcc -static 用于编译一个程序时,会使此程序静态编译(把动态库和所依赖的任何的东西,都编译进本程序),编译好后,文件会非常大,但是,运行时就不需要依赖任何动态库。
更多推荐
已为社区贡献1条内容
所有评论(0)