如何SSH Docker容器 [英] how to ssh docker container
本文介绍了如何SSH Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行容器 hypriot / rpi-busybox-httpd
我正在尝试通过SSH移植到docker容器:但是它给了错误:
I am trying to ssh to docker container: but it is giving error :
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
It could be your image does not have the binary /bin/bash installed (as suggested before), I had the same problem and I was able to enter into the container using /bin/sh
docker exec -ti cc55da85b915 /bin/sh
另一种解决方法是直接执行命令而无需访问任何shell。
Another workaround could be execute directly the commands without get access to any shell.
docker exec -ti cc55da85b915 ls /etc
这篇关于如何SSH Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文