一个伪linux粉丝的blog
  1. 首页
  2. unix/linux
  3. 正文

Docker "fork/exec /proc/self/exe: no such file or directory\""

2020年04月04日 791点热度 0人点赞 0条评论

前2天测试一个docker容器时发现一个以前未接触到的报错,这里简单记录一下

尝试进入容器

docker exec -it a23a033d0f6e bash

失败报错

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "process_linux.go:75: starting setns process caused \"fork/exec /proc/self/exe: no such file or directory\""

容器状态正常,因为它提供的web服务,我访问的正欢,日志查看正常,可以看到我的当前浏览记录

docker logs a23a033d0f6e -f --tail=100|grep Mozilla

找出容器id

docker ps -a|grep abc_controller
a23a033d0f6e a508e44c60d5 "bash /usr/local/b..." 4 months ago Up 2 weeks 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp abc_controller_1

2、根据 docker 容器 id a23a033d0f6e 找到对应的 libcontainerd 的运行pid 16953

  • 得到进程id方法1

ps -ef|grep libcontainerd |grep a23a033d0f6e

root 16935 2031 0 3月17 ? 00:19:22 docker-containerd-shim a23a033d0f6e0571b2472a1c4d54503610b7908bdb574728939229b929ed0604 /var/run/docker/libcontainerd/a23a033d0f6e0571b2472a1c4d54503610b7908bdb574728939229b929ed0604 docker-runc

  • 得到进程id方法2

docker inspect -f{{.State.Pid}} a23a033d0f6e
16953

docker exec 出现问题时另一种折衷解决办法,通过 nsenter 进入容器。

  • 这个是新学到的命令:)
    # nsenter -m -t 16953 bash

问题简单解决
docker stop {container-id}
docker stop a23a033d0f6e
docker start {container-id}
docker start a23a033d0f6e

问题复杂解决方法,创建并重新挂载缺失的目录,自然就找到目录,可以进入了,无特殊理由,不推荐。
https://www.jianshu.com/p/8e61ae8e2327

Related posts:

  1. crontab log error
  2. docker-upgrade
  3. iWatch monitor ftp site file created and send mail
  4. plowshare -- command-line application to download files for file-sharing websites
标签: docker nsenter
最后更新:2020年04月04日

WanJie

正经人谁写博客啊?你写博客吗?写出来的那能叫博客?

点赞
< 上一篇
下一篇 >

文章评论

取消回复

分类目录
  • network
  • Uncategorized
  • unix/linux
  • 业界资讯
  • 公司杂事
  • 数码影像
  • 美剧
  • 美图共赏
  • 英语学习

COPYRIGHT © 2008-2021 一个伪linux粉丝的blog. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS