在docker的centos容器里執(zhí)行命令時(shí),發(fā)現(xiàn)有些命令(如envsubst
)提示'Command not found'肛循。
這是因?yàn)槭褂?code>docker pull centos命令下載下來(lái)的centos7是centos的最小鏡像,很多命令沒有被安裝雄人,需要額外安裝傅联。
查找
查找命令所在的安裝包:
> yum provides envsubst
或者
> yum whatprovides envsubst
查看提供的相關(guān)信息:
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.cn99.com
* epel: mirrors.aliyun.com
* extras: mirrors.163.com
* updates: mirrors.163.com
base/7/x86_64/filelists_db | 7.1 MB 00:00:01
epel/x86_64/filelists | 10 MB 00:00:01
extras/7/x86_64/filelists_db | 189 kB 00:00:00
updates/7/x86_64/filelists_db | 1.4 MB 00:00:00
gettext-0.19.8.1-2.el7.x86_64 : GNU libraries and utilities for producing multi-lingual messages
Repo : base
Matched from:
Filename : /usr/bin/envsubst
找出我們要安裝的包,是gettext
召娜。
安裝
> yum install gettext
驗(yàn)證
> envsubst --version
輸出了版本信息,命令安裝成功惊楼。