如何在Dockerfile中启动另一个bash [英] How to start another bash in Dockerfile
问题描述
我想按照本教程如何在CentOS上升级GCC 。
在本教程的最后,作者使用 scl enable devtoolset-1.1 bash
启动一个新的shell,其中所有环境均已更新。我写了以下Dockerfile:
In the end of the tutorial, the author uses scl enable devtoolset-1.1 bash
to launch a new shell where all the environments are updated. I write the following Dockerfile:
Run ... \
&& yum install devtoolset-1.1 \
&& scl enable devtoolset-1.1 bash
但是,当我从Dockerfile生成的映像运行容器时,我发现GCC版本仍然是4.4.7,这表明我输入的是旧shell。
However, when I run the container from the images generated by the Dockerfile, I find that the GCC version is still 4.4.7, which indicates that I enter the old shell.
尽管我通过显式定义CC成功地更新了容器中的GCC ,CPP,CXX变量,我仍然想知道如何在Dockerfile中使用 scl命令更新GCC。 也就是说,如何在Dockerfile中输入新的shell?
Though I success in updating GCC in the container by explicitly defining the CC, CPP, CXX variables, I still want to know how to update GCC with "scl" command in a Dockerfile. That's to say, how to enter a new shell in a Dockerfile?
谢谢。 ^ _ ^
推荐答案
在Dockerfile的指令中,您拥有SHELL
Among the directives of the Dockerfile, you have SHELL
https://docs.docker.com/engine/reference/builder/# shell
此文档中的
SHELL指令也可以是如果需要其他外壳程序(例如zsh,csh,tcsh等),请在Linux上使用。
这篇关于如何在Dockerfile中启动另一个bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!