Docker 容器中“TERM environment variable not set.”问题解决

  在查容器内部资源利用情况时候,发现top命令无法使用,报错“TERM environment variable not set.”。从网上找到了解决方案,如下。

[root@localhost ~]# docker exec -ti redis /bin/bash
[root@9bf53a30e849 /]# top
TERM environment variable not set.
[root@9bf53a30e849 /]# echo $TERM
dumb
[root@9bf53a30e849 /]# export TERM=dumb
[root@9bf53a30e849 /]# top             
top - 11:14:13 up 85 days, 20:18,  0 users,  load average: 8.75, 8.61, 8.53
Tasks:  28 total,   1 running,  27 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.7 us,  0.3 sy, 12.5 ni, 85.6 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 13175309+total, 10896009+free,  9802708 used, 12990288 buff/cache
KiB Swap:  4194300 total,  4194300 free,        0 used. 11734181+avail Mem 

   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                            
     1 root      20   0   11604   1364   1164 S   0.0  0.0   1:04.54 run.sh                                                                                                                             
    11 nagios    20   0   44212   1352    804 S   0.0  0.0   5:50.39 nrpe                                                                                                                               
   126 root      20   0   22720   1308    700 S   0.0  0.0   0:38.39 crond                                                                                                                              
   128 root      20   0   82488   3484   2640 S   0.0  0.0   0:00.00 sshd                                                                                                                               
   129 root      20   0  322668   2096   1792 S   0.0  0.0 115:39.77 LiveDistribute.                                                                                                                    
   130 root      20   0  322668   1924   1736 S   0.0  0.0 116:06.00 LiveDistribute.                                                                                                                    
   131 root      20   0  322668   2080   1736 S   0.0  0.0 116:44.28 LiveDistribute.                                                                                                                    
   132 root      20   0  322668   1932   1736 S   0.0  0.0 113:00.33 LiveDistribute.                                                                                                                    
   133 root      20   0  322668   1912   1736 S   0.0  0.0 111:23.64 LiveDistribute.                                                                                                                    
   134 root      20   0  257132   2064   1724 S   0.0  0.0  11:13.00 LiveDistribute.                                                                                                                    
   135 root      20   0  257132   2060   1724 S   0.0  0.0  11:30.31 LiveDistribute.                                                                                                                    
   136 root      20   0  257132   2064   1724 S   0.0  0.0  11:12.71 LiveDistribute.                                                                                                                    
   137 root      20   0  257132   4100   1724 S   0.0  0.0  11:25.46 LiveDistribute.                                                                                                                    
   275 root      20   0   10792   2664   1168 S   0.0  0.0 573:00.03 keepBusinessPro                                                                                                                    
   438 root      20   0    9508   1396   1192 S   0.0  0.0   0:00.00 startTaskManage                                                                                                                    
   455 root      20   0 38.893g 1.079g  14000 S   0.0  0.9 814:57.20 java                                                                                                                               
  3512 root      20   0   11744   1748   1428 S   0.0  0.0   0:00.02 bash                                                                                                                               
 11622 root      20   0   11740   1748   1428 S   0.0  0.0   0:00.02 bash                                                                                                                               
 11717 root      20   0   24776   1780   1440 S   0.0  0.0   0:00.00 vi                                                                                                                                 
 50099 root      20   0   11744   1864   1468 S   0.0  0.0   0:00.02 bash                                                                                                                               
 51441 root      20   0    9512   1428   1220 S   0.0  0.0   0:00.00 startTaskProces                                                                                                                    
 51470 root      20   0 35.458g 717284  15548 S   0.0  0.5   0:24.31 java                                                                                                                               
 51475 root      20   0    4312    352    280 S   0.0  0.0   0:00.00 sleep                                                                                                                              
 51476 root      20   0   24212   1472   1096 R   0.0  0.0   0:00.00 top                                                                                                                                
 71899 root      20   0   11740   1860   1468 S   0.0  0.0   0:00.02 bash                                                                                                                               
125382 root      20   0   11740   1908   1496 S   0.0  0.0   0:00.04 bash                                                                                                                               
126866 root      20   0   11740   1864   1468 S   0.0  0.0   0:00.02 bash                                                                                                                               
127307 root      20   0   24772   1700   1364 S   0.0  0.0   0:00.01 vi  

 

posted @ 2016-03-31 11:25  振宇要低调  阅读(18102)  评论(0编辑  收藏  举报