0

I have a Docker image that is used for running tests in Jenkins and Bamboo. I need to upgrade the version of g++ used (to something with C++11 support).

I tried using a Dockerfile that looks roughly like the following one:

FROM docker.blahblahblah/centos/6.6:latest

RUN yum install -y git gcc-c++ imake centos-release-scl-rh devtoolset-7-toolchain

# I've tried putting this into /etc/bashrc, ~/.bashrc, ~/.bash_profile
RUN echo "source scl_source enable devtoolset-7" >> ~/.bashrc

My issue is that when g++ is used within the container, it uses the older one, instead of the newer one in devtoolset-7, even though the newer one should be sourced from the bashrc. (Maybe I'm misunderstanding how Docker will try to run everything.)

Could anyone point me in the right direction here?

CoffeeTableEspresso
  • 2,614
  • 1
  • 12
  • 30
  • `centos:6.6` in dockerhub even do not have `devtoolset-7-toolchain`. So this is your private repo, then you need to afford more information. E.g. How you verify it use the old one, not the new one. From `exec` or just use `CMD`, and what's your `CMD` or `Entrypoint` look like, these all related to your matter. – atline Jun 25 '19 at 01:51
  • @atline I verify it's using the old version of because I added a `g++ --version` in a few places and confirmed it's the old version instead of the newer devtools one. `g++` is actually called from a python script that runs inside the Docker container which calls `make` which calls `g++`. The container has no `CMD` or `ENTRYPOINT`. – CoffeeTableEspresso Jun 25 '19 at 17:10

0 Answers0