How to install telnet in Docker for Windows 10
Asked Answered
O

5

7

When I run telnet command in Docker it does not run.

enter image description here

Could you please tell me how to install telnet in Docker for Windows?

Obligee answered 2/9, 2016 at 7:16 Comment(7)
I have rub telnet command and it says command not found , i am new in this i dont know how to install telnet in itObligee
How are you trying to use telnet in your container?Stringency
that it what i am asking , i am trying to run telnet in my docker container , how to do that ,Obligee
pls bear with me i am complete novice in dockerObligee
Okay, but I think you should look for a Beginner's Guide for Docker and then ask your questions :D docker run -it ubuntu bash gives you a shell in ubuntu. There you can use the normal shell commands, e.g. apt-get update && apt-get install xinetd telnetd see here. After this you have telnet installed and can use it with telnet <ip>. But you have no understanding what Docker is, so you should learn this first.Stringency
Let us continue this discussion in chat.Stringency
There is a docker image on docker hub for telnet: hub.docker.com/r/mikesplain/telnetStringency
S
2

There is a docker image for it:

docker run mikesplain/telnet <host> <port>
Stringency answered 2/9, 2016 at 8:53 Comment(1)
the image is based on alpine!Gwendagwendolen
S
7

Old question I know but you can install telnet on docker for windows with the following in your dockerfile

  RUN powershell -Command Add-WindowsFeature "telnet-client"
Severally answered 15/4, 2019 at 20:43 Comment(2)
After adding the line I got an error: hcs::CreateComputeSystem <some hash>: The virtual machine could not be started because a required feature is not installed.External
That is because the RUN dockerfile command needs start the container to exec the command inside. The given machine where the docker build was executed had missing features required for starting a container.External
S
2

There is a docker image for it:

docker run mikesplain/telnet <host> <port>
Stringency answered 2/9, 2016 at 8:53 Comment(1)
the image is based on alpine!Gwendagwendolen
H
0

If you are trying to telnet into your container to gain access to it, that isn't how you would want to connect. Docker provides that functionality.

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. In that case using sh instead of bash in your commands should work.

Horehound answered 3/9, 2016 at 4:20 Comment(0)
F
0

If you were using Kubernetes, you could install telnet in k8s by running:

apk update
apk add busybox-extras
telnet 10.0.180.37 11211
Feminize answered 25/2, 2021 at 10:15 Comment(0)
A
0

The following command will work if you want to install Telnet client in a running Windows Docker container. Just run this command in your container's terminal:

dism /online /Enable-Feature /FeatureName:TelnetClient
Athens answered 1/2, 2023 at 11:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.