C++11 src compiles after docker built, but won't for Dockerfile

I’m trying to compile a C++ code base to be built on top of OpenCV and other libs.
Ideally this C++ app would compile and be accessible from the Docker command line.

I can use the Dockerfile (Ubunto) to create a Docker image with OpenCV.
From their I can do a cmake and make and the app builds correctly and can be run from the command line.

However if I try to RUN cmake . && make in the actual Dockerfile (at end) then it throws up errors that relate to not being a c++11 compiler setting. (i.e. std::stoi not found, toString, etc)
First files that don’t require c++11 compile fine.

CMakeLists set(CMAKE_CXX_FLAGS … and set it to -std=c++11

Is there something that happens after a Dockerfile is finished building which would cause it to work there but not while building Docker?
Is there a way to force the full Dockerfile (compiling OpenCV and others) to use C++11?
Other suggestions?
There seems to be a general lack of info regarding C or C++ for Docker.

1 Like