Installing cmake 3.17.3 inside a Docker image

Installation of xgboost requires cmake of version at least 3.17.3. And apt-get was only installing cmake 3.5.x, or something like that. A nice solution is described in this post. I picked the second approach, from the binary. This is the code I included in my Dockerfile:

RUN mkdir /opt/cmake && \
    cd /opt/cmake && \
    wget https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3-Linux-x86_64.sh && \
    bash cmake-3.17.3-Linux-x86_64.sh --skip-license && \
    ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake && \
    echo $(cmake --version)

The last line is just to check that it’s working. Also, note that you can install different versions of cmake. You can find your favorite one on their website.

[ cmake  docker  ]