运维开发网

如何ssh docker容器

运维开发网 https://www.qedev.com 2020-06-07 14:25 出处:网络 作者:运维开发网整理
我正在运行容器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: st
我正在运行容器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"

我马上做了什么?

它可能是你的图像没有安装二进制/ bin / bash(如前所述),我有同样的问题,我能够使用/ bin / sh进入容器

docker exec -ti cc55da85b915 /bin/sh

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

docker exec -ti cc55da85b915 ls /etc
0

精彩评论

暂无评论...
验证码 换一张
取 消