一个伪linux粉丝的blog

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

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

4 4 月, 2020 2377点热度 1人点赞 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

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

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

This site uses Akismet to reduce spam. Learn how your comment data is processed.

归档
分类
  • network / 332篇
  • Uncategorized / 116篇
  • unix/linux / 121篇
  • 业界资讯 / 38篇
  • 公司杂事 / 11篇
  • 数码影像 / 12篇
  • 美剧 / 3篇
  • 美图共赏 / 21篇
  • 英语学习 / 3篇
标签聚合
Ubuntu Google Voice 天翼live openssl ldap jira Nginx dreamhost空间 debian 邮件归档 d90 postgres wget 浏览器 gitlab 虚拟主机 squid nexus k8s docker VPS kubectl google-chrome 泰国 网站运营 Google ssh dreamhost kernel deepseek

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

Theme Kratos Made By Seaton Jiang