If you are using a docker container the following method would be better:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16
Ensure you have curl installed before using this method. This was tested on ubuntu 20.04 Docker container.