在docker的centos容器里执行命令时,发现有些命令(如envsubst
)提示'Command not found'。
这是因为使用docker pull centos
命令下载下来的centos7是centos的最小镜像,很多命令没有被安装,需要额外安装。
查找
查找命令所在的安装包:
> yum provides envsubst
或者
> yum whatprovides envsubst
查看提供的相关信息:
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
验证
> envsubst --version
输出了版本信息,命令安装成功。