【发布时间】:2021-08-14 07:55:32
【问题描述】:
我有一个 bash 4.2 的基本映像,我想将其升级到 5.1
我已尝试解压缩,然后将路径变量设置为该文件夹:
RUN curl -o /tmp/bash-5.1.tar.gz ${BASH_URL}/bash/5.1/bash-5.1.tar.gz \
&& tar -xvf /tmp/bash-5.1.tar.gz -C /usr/local/bin \
&& rm /tmp/bash-5.1.tar.gz
ENV PATH=/usr/local/bin/bash-5.1:$PATH
但是,当我构建映像时,其中的所有容器仍然运行 bash 4.2。我也无法在.tar.gz 包中找到像grep 这样的命令,尽管它不在官方网站上,所以我不确定我什至应该在哪里设置PATH。这是tarball的第一层:
ABOUT-NLS bashline.c conftypes.h findcmd.c lib parse.y shell.c unwind_prot.c
aclocal.m4 bashline.h copy_cmd.c findcmd.h list.c patchlevel.h shell.h unwind_prot.h
alias.c bashtypes.h COPYING flags.c locale.c pathexp.c sig.c variables.c
alias.h bracecomp.c cross-build flags.h m4 pathexp.h sig.h variables.h
array.c braces.c CWRU general.c mailcheck.c pathnames.h.in siglist.c version.c
arrayfunc.c builtins dispose_cmd.c general.h mailcheck.h pcomplete.c siglist.h xmalloc.c
arrayfunc.h builtins.h dispose_cmd.h hashcmd.c make_cmd.c pcomplete.h stringlib.c xmalloc.h
array.h ChangeLog doc hashcmd.h make_cmd.h pcomplib.c subst.c Y2K
assoc.c CHANGES error.c hashlib.c Makefile.in po subst.h y.tab.c
assoc.h command.h error.h hashlib.h MANIFEST POSIX support y.tab.h
AUTHORS COMPAT eval.c include mksyntax.c print_cmd.c syntax.h
bashansi.h config-bot.h examples input.c NEWS quit.h test.c
bashhist.c config.h.in execute_cmd.c input.h nojobs.c RBASH test.h
bashhist.h config-top.h execute_cmd.h INSTALL NOTES README tests
bashintl.h configure expr.c jobs.c parser-built redir.c trap.c
bashjmp.h configure.ac externs.h jobs.h parser.h redir.h trap.h
我本来希望看到 grep、echo 和 chmod 等内容。
我的目标只是能够构建一个 dockerfile 并让它运行 bash 5.1。除此部分外,文件中的所有其他内容均有效。
【问题讨论】:
-
压缩包到底包含什么?您分配的
PATH期望它包含一个目录bash-5.1,该目录应该包含一个字面上称为bash的二进制文件,以便它实际工作。我猜你误解了PATH的工作原理;但请随时 edit 澄清您的问题,如果重复不正确,请联系我。 -
@tripleee 我从这个问题stackoverflow.com/questions/51030884/… 得到了使用
PATH的想法我不太清楚我在这里到底在做什么,因为我在互联网上找不到任何东西在图像中升级 bash。 -
为什么特别需要更新版本的 bash?我的一般经验是,许多东西可以只使用POSIX shell features 重写(在这种情况下,他们甚至可以使用 Alpine 图像中最小的
/bin/sh),而那些不能用高级语言表达的东西通常更容易.
标签: bash docker dockerfile