OCI runtime exec failed: exec failed: container_linux.go:370 docker exec -it 失败的解决方法
运行了个docker,想进shell看看,使用常规的命令docker exec -it<container ID> /bin/bash 发现报错:♥root-22:33:34=>>~# docker exec -it 2ade3c165388 /bin/bashOCI runtime exec failed: exec failed: container_linux.go:
·
运行了个docker,想进container的shell看看,使用常规的命令docker exec -it <container ID> /bin/bash 发现报错:
♥root-22:33:34=>>~# docker exec -it 2ade3c165388 /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: "/bin/bash": stat /bin/bash: no such file or directory: unknown
使用ls命令看下:
♥root-22:54:25=>>~# docker exec -it 2ade3c165388 ls /bin/bash
ls: cannot access '/bin/bash': No such file or directory
确实没有/bin/bash。
再试下:
♥root-22:54:36=>>~# docker exec -it 2ade3c165388 ls /bin/sh
/bin/sh
♥root-22:56:10=>>~#
发现/bin/sh是有的,加个-l看下
♥root-22:56:10=>>~# docker exec -it 2ade3c165388 ls /bin/sh -lh
lrwxrwxrwx 1 root root 12 Apr 23 2020 /bin/sh -> /bin/busybox
♥root-22:57:27=>>~#
明白了,这个container是用Alpine制作,类似嵌入式linux,软连接到busybox。
所以使用以下命令可以打开container的shell:docker exec -it <container> /bin/sh
更多推荐
已为社区贡献1条内容
所有评论(0)