一尘不染

如何SSH Docker容器

docker

我正在运行容器 hypriot / rpi-busybox-httpd

我正在尝试SSH到docker容器:但它给出了错误:

pi@raspberrypi:~ $ docker exec -it cc55da85b915 bash
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"bash\": executable file not found in $PATH"

pi@raspberrypi:~ $ docker exec -it cc55da85b915 sh
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"sh\": executable file not found in $PATH"

我马上就做吗?


阅读 370

收藏
2020-06-17

共1个答案

一尘不染

可能是您的映像未安装二进制/ bin / bash(如之前所建议),我遇到了同样的问题,因此我可以使用/ bin / sh进入容器

docker exec -ti cc55da85b915 /bin/sh

另一个解决方法是直接执行命令,而无需访问任何shell。

docker exec -ti cc55da85b915 ls /etc
2020-06-17