[英]How to install telnet in Docker for Windows 10
我知道一个老问题,但您可以在 dockerfile 中使用以下内容在 docker for windows 上安装 telnet
RUN powershell -Command Add-WindowsFeature "telnet-client"
有一个 docker 图像:
docker run mikesplain/telnet <host> <port>
If you are trying to telnet into your container to gain access to it, that isn't how you would want to connect.如果您尝试 telnet到您的容器以访问它,那不是您想要的连接方式。 Docker provides that functionality.
Docker 提供了该功能。
Connect into a running container - Docs :连接到正在运行的容器 -文档:
docker exec -it <container name> bash
$ root@665b4a1e17b6:/#
Start a container from image, and connect to it - Docs :从图像启动一个容器,并连接到它 - 文档:
docker run -it <image name> bash
$ root@665b4a1e17b6:/#
Note: If it is an Alpine based image, it may not have Bash installed.注意:如果它是基于 Alpine 的映像,则它可能没有安装 Bash。 In that case using
sh
instead of bash
in your commands should work.在这种情况下,在您的命令中使用
sh
而不是bash
应该可以工作。
If you were using Kubernetes, you could install telnet
in k8s by running:如果您使用的是 Kubernetes,则可以通过运行以下命令在 k8s 中安装
telnet
:
apk update
apk add busybox-extras
telnet 10.0.180.37 11211
The following command will work if you want to install Te.net client in a running Windows Docker container.如果您想在正在运行的 Windows Docker 容器中安装 Te.net 客户端,则以下命令将起作用。 Just run this command in your container's terminal:
只需在容器的终端中运行此命令:
dism /online /Enable-Feature /FeatureName:TelnetClient
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.