Docker Community Forums

Share and learn in the Docker community.

Docker visualcpp && cmake

(Diiiego83) #1

Hi all,

I’m trying to create a container with cmake && visualcpp to be able to compile my C++ code but with no success.

This is my docker File:

# escape=`

FROM microsoft/windowsservercore

RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

# install visualcpp-build-tools
RUN powershell -NoProfile -InputFormat None -Command `
    choco install git 7zip -y; `
    choco install visualcpp-build-tools `
        --version 15.0.26228.20170424 -y; `
    Write-Host 'Waiting for Visual C++ Build Tools to finish'; `
    Wait-Process -Name vs_installer

RUN choco feature enable -n=allowGlobalConfirmation
RUN choco install cmake --installargs 'ADD_CMAKE_TO_PATH=""System""' 

# install windows-sdk-8.1   
RUN choco install windows-sdk-8.1 -y;

ADD mycode C:\mycode

I build it with the command docker build . -t test
and run it with the command docker run -it test cmd.exe

Inside the container:

cd c:\mycode
mkdir build
cd  build
cmake ..

And i have this error:

-- Building for: Visual Studio 15 2017
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:2 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/seismic-drive-client-api/cpp/build/CMakeFiles/CMakeOutput.log".
See also "C:/seismic-drive-client-api/cpp/build/CMakeFiles/CMakeError.log".

Any idea of what i missed?