Issue building cmake from source in Dockerfile: exit code: 6

I am having difficulty building the following Dockerfile that builds cmake from source.

FROM centos:7

RUN yum -y update && \
	yum -y install wget

RUN mkdir -p ~/programs && \
	cd ~/programs && \
	wget https://cmake.org/files/v3.19/cmake-3.19.0.tar.gz && \
	tar -zxvf cmake-3.19.0.tar.gz && \
	rm cmake-3.19.0.tar.gz && \
	cd cmake-3.19.0 && \
	./bootstrap --prefix=/usr/local && \
	make && \
	make install

I keep getting exit code: 6:

...
#6 4.330 cmake-3.19.0/Tests/RunCMake/CTestResourceAllocation/lotsoftests-ctest-s-res-check.cmake
#6 4.330 cmake-3.19.0/Tests/RunCMake/CTestResourceAllocation/lotsoftests.cmake
#6 4.330 cmake-3.19.0/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-cache-check.cmake
#6 4.330 cmake-3.19.0/Tests/RunCMake/CTestResourceAllocation/notenough1-ctest-s-res-cache-result.txt
#6 4.330 cmake-3.19.0/Tests/RunCMake
#6 4.330 [output clipped, log limit 100KiB/s reached]
------
executor failed running [/bin/sh -c mkdir -p ~/programs &&     cd ~/programs &&     wget https://cmake.org/files/v3.19/cmake-3.19.0.tar.gz &&     tar -zxvf cmake-3.19.0.tar.gz &&     rm cmake-3.19.0.tar.gz &&     cd cmake-3.19.0 &&     ./bootstrap --prefix=/usr/local &&     make &&     make install]: exit code: 6

I thought I have a permission issue but I get the same error even if I add USER root to my Dockerfile.

Googling exit code 6 does not provide any answer.

Could someone kindly help?