简体   繁体   English

如何在Docker安装te.net for Windows 10

[英]How to install telnet in Docker for Windows 10

When I run te.net command in Docker it does not run.当我在 Docker 中运行 te.net 命令时,它没有运行。

在此处输入图像描述

Could you please tell me how to install te.net in Docker for Windows?你能告诉我如何在 Docker 为 Windows 安装 te.net 吗?

我知道一个老问题,但您可以在 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM