解决docker exec 无法执行问题


docker exec nova_libvirt ls

rpc error: code = 13 desc = invalid header field value “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\\”\”\n”

# 查找出 docker 的容器 id
[root@rg1-ostack009 ~]# docker ps |grep nova_libvirt
0f69b199be9d        172.16.59.153/lokolla/centos-source-nova-libvirt:15.0.6-ccr-1.0.0                  "kolla_start"            8 months ago        Up 6 months                             nova_libvirt
# 根据 docker 容器id找出 容器设备
[root@rg1-ostack009 ~]# docker inspect --format='{{.GraphDriver.Data.DeviceName}}' 0f69b199be9d
docker-8:2-402662382-6740ee9b728b637dcd276b9784afdc1e0910b18a5989810085b444f6050294ae

# 根据 docker 容器id找出 容器运行pid
[root@rg1-ostack009 ~]# ps -ef |grep 0f69b199be9d
root     14981  2507  0  2019 ?        00:00:03 docker-containerd-shim 0f69b199be9d8c65e77c4491475d504d9f05e440b1ff6a4ff15456b5e03d4211 /var/run/docker/libcontainerd/0f69b199be9d8c65e77c4491475d504d9f05e440b1ff6a4ff15456b5e03d4211 docker-runc

root     16820 33877  0 11:47 pts/12   00:00:00 grep --color=auto 0f69b199be9d

# 查找容器rootfs path
[root@rg1-ostack009 ~]# cat /var/run/docker/libcontainerd/0f69b199be9d8c65e77c4491475d504d9f05e440b1ff6a4ff15456b5e03d4211/config.json |python -m json.tool | grep rootfs
        "rootfsPropagation": "shared"
        "path": "/var/lib/docker/devicemapper/mnt/6740ee9b728b637dcd276b9784afdc1e0910b18a5989810085b444f6050294ae/rootfs"

# 重新挂载 docker 容器rootfs
You have mail in /var/spool/mail/root
[root@rg1-ostack009 ~]# mount  /dev/mapper/docker-8\:2-402662382-6740ee9b728b637dcd276b9784afdc1e0910b18a5989810085b444f6050294ae  -o rw,relatime,nouuid,attr2,inode64,sunit=512,swidth=1024,noquota -t xfs /var/lib/docker/devicemapper/mnt/6740ee9b728b637dcd276b9784afdc1e0910b18a5989810085b444f6050294ae


Leave a Reply

Your email address will not be published.

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

%d bloggers like this: