如果docker支持我在ubuntu中使用的命令:
locate filename和
grep -Hrn -A 5 'search text' --include="*.php" /DirectoryPath/如果是,我如何安装它们?
在我的中添加命令之后,更新了#2 :
RUN apt-get install -y grep mlocate我可以运行命令:
grep -Hrn -A 5 'var' --include="*.conf" /var/www与有效的结果,但错误与定位:
root@11ed27f97ac4:/var/www# locate -help
Usage: locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database.
-A, --all only print entries that match all patterns
-b, --basename match only the base name of path names
-c, --count only print number of found entries
-d, --database DBPATH use DBPATH instead of default database (which is
/var/lib/mlocate/mlocate.db)
-e, --existing only print entries for currently existing files
-L, --follow follow trailing symbolic links when checking file
existence (default)
-h, --help print this help
-i, --ignore-case ignore case distinctions when matching patterns
-l, --limit, -n LIMIT limit output (or counting) to LIMIT entries
-m, --mmap ignored, for backward compatibility
-P, --nofollow, -H don't follow trailing symbolic links when checking file
existence
-0, --null separate entries with NUL on output
-S, --statistics don't search for entries, print statistics about each
used database
-q, --quiet report no error messages about reading databases
-r, --regexp REGEXP search for basic regexp REGEXP instead of patterns
--regex patterns are extended regexps
-s, --stdio ignored, for backward compatibility
-V, --version print version information
-w, --wholename match whole path name (default)
Report bugs to mitr@redhat.com.
root@11d2e77af9c4:/var/www# mlocate -i error.log
mlocate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory为什么在最后一行出错?好像我用了有效的语法?
提前感谢!
发布于 2021-09-26 12:08:06
在您的docker文件中,必须添加以下命令:
RUN apt install -y grep mlocate发布于 2022-02-16 18:46:23
在运行“定位”之前将其添加到您的Dockerfile中
RUN /etc/cron.daily/mlocatehttps://stackoverflow.com/questions/69334719
复制相似问题