Docker(六)安装telnet命令

  在使用docker容器时,有时候需要使用一些其他命令,如ifconfig,telnet等,但是会提示错误:

bash-5.0# telnet 11.161.35.45 27017                                                                                                                                        
bash: telnet: command not found

  这时候需要执行如下命令(apt命令详细参考 Linux之yum&apt):

bash-5.0# apt-get update
Get:1 http://security.debian.org/debian-security buster/updates InRelease [65.4 kB]
Get:2 http://deb.debian.org/debian buster InRelease [121 kB]                                  
Get:3 http://deb.debian.org/debian buster-updates InRelease [51.9 kB]                                                                                                      
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [291 kB]                                                                               
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]                                                                                                    
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7907 kB]                                                                                                    
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [10.9 kB]                                                                                            
Get:4 http://security.debian.org/debian-security buster/updates/main amd64 Packages [291 kB]                                                                               
Fetched 8297 kB in 2min 37s (53.0 kB/s)                                                                                                                                    
Reading package lists... Done
bash-5.0# 

  然后安装telnet命令:

bash-5.0# apt-get install  telnet                                                                                                                                          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  telnet
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 70.4 kB of archives.
After this operation, 167 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 telnet amd64 0.17-41.2 [70.4 kB]
Fetched 70.4 kB in 0s (345 kB/s) 
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package telnet.
(Reading database ... 12572 files and directories currently installed.)
Preparing to unpack .../telnet_0.17-41.2_amd64.deb ...
Unpacking telnet (0.17-41.2) ...
Setting up telnet (0.17-41.2) ...
update-alternatives: using /usr/bin/telnet.netkit to provide /usr/bin/telnet (telnet) in auto mode
原文地址:https://www.cnblogs.com/ryjJava/p/14846309.html