docker 报错,无法进入容器
- 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的过程中遇到以上问题,不用慌,可以使用这种方法解决,【【【看清错误错误代码,别白忙活一场】】】
在任意位置新建一个shell脚本 fix-docker.sh
#!/bin/bash
# author: phpor
#
LIBCONTAINERD_DIR=/var/run/docker/libcontainerd
function main() {
local pidOfCotainerd=$(pidof docker-containerd-current)
local mountinfo=$(< /proc/$pidOfCotainerd/mountinfo)
for config in $LIBCONTAINERD_DIR/*/config.json;do
local cid=$(awk -F'/' '{print $6}' <<<$config)
local rootpath=$(jq -r .root.path $config|sed 's/\/rootfs$//')
grep "$rootpat