title: How to use g++ in a docker container
body: <p>I want to build and run the C++ program in a docker container. I found this <a href="https://hub.docker.com/r/frolvlad/alpine-gxx/dockerfile" rel="nofollow noreferrer">https://hub.docker.com/r/frolvlad/alpine-gxx/dockerfile</a></p>
  
  <p>my dockerfile:</p>
  
  <pre><code>FROM frolvlad/alpine-gcc
  COPY . /usr/src/myapp
  WORKDIR /usr/src/myapp
  RUN apk add --no-cache g++ &amp;&amp;\ g++ main.cpp -o myapp
  CMD ["./myapp"]
  </code></pre>
  
  <p>I'm running <code>$ docker build</code> and get the following error:</p>
  
  <pre><code>/bin/sh:  g++: not found
  The command '/bin/sh -c apk add --no-cache g++ &amp;&amp;\ g++ main.cpp -o myapp' returned a non-zero code: 127
  </code></pre>
  
  <p>What's wrong?</p>