title: How to install gcc/g++ 9 on CentOS 7 docker (centos:7)
body: <p>In order to use the C++17 include <code>&lt;filesystem&gt;</code> I need gcc-9 package in my centos 7 docker.</p>
  <p>By default <a href="https://hub.docker.com/_/centos" rel="noreferrer">centos:7</a>  will install gcc 4.8.5 from the regular distro repo.</p>
  <pre class="lang-sh prettyprint-override"><code>docker run --rm -it centos:7
  # yum install -y gcc
  # gcc --version
  gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
  </code></pre>
  <p>Is there any way to easily install a gcc-9 (or later) package (i.e. not build it from source)</p>
  <p>Thanks !</p>
  <p>note: need gcc-9 to have good C++17 <code>&lt;filesystem&gt;</code> support.<br />
  GCC 9 Release note:</p>
  <blockquote>
  <p>Using the types and functions in <code>&lt;filesystem&gt;</code> does not require linking with <code>-lstdc++fs</code> now.</p>
  </blockquote>
  <p>src: <a href="https://gcc.gnu.org/gcc-9/changes.html" rel="noreferrer">https://gcc.gnu.org/gcc-9/changes.html</a></p>