一个伪linux粉丝的blog

  1. 首页
  2. unix/linux
  3. 正文

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

4月 4, 2020 1266点热度 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

相关文章:

  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
最后更新:4月 4, 2020

wanjie

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据。

归档
分类
  • network / 322篇
  • Uncategorized / 114篇
  • unix/linux / 110篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 20篇
  • 英语学习 / 3篇
标签聚合
刷机 d90 虚拟主机 VPS 天翼live docker debian dreamhost 黑莓8700 dreamhost空间 nexus Google Voice jira iMac 泰国 unveiled today Android 职责 Google 邮件归档 ldap google-chrome kernel Linux wget 网站运营 k8s Nginx Ubuntu gitlab

COPYRIGHT © 2008-2022 wanjie.info. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang