xianlubird / mydocker

<<自己动手写docker>> 源码
Apache License 2.0
1.98k stars 560 forks source link

code-4.1 "fork/exec /proc/self/exe: no such file or directory" #80

Open baipangbai opened 3 years ago

baipangbai commented 3 years ago

环境:Linux vagrant 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  1. 在container_process.go中不添加 "cmd.Dir = "/root/busybox" 这行,不会报/proc/self/exe 文件不存在。 报错信息是:{"level":"error","msg":"Exec loop path error exec: \"sh\": executable file not found in $PATH","time":"2021-05-27T14:04:15Z"} {"level":"fatal","msg":"exec: \"sh\": executable file not found in $PATH","time":"2021-05-27T14:04:15Z"}

  2. 在container_process.go中添加 "cmd.Dir = "/root/busybox"这行后,报错"fork/exec /proc/self/exe: no such file or directory" (mount确认已经绑定过 #mount: /proc: proc already mounted on /proc.)

JasonkayZK commented 3 years ago

你要把解压的busybox放到/root下,你新挂载的文件系统没有 sh 命令;