While the original way is still valid, in Docker it's now easier to copy the Composer executable from its Docker image.
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
or for PHP < 7.2.5
COPY --from=composer:2.2 /usr/bin/composer /usr/local/bin/composer
Please note that without the installer, dependencies won't be checked, so you also need to install git and/or zip, and preferably optional dependencies like mbstring too.
Found accidentally on the Stack Overflow. There is also another interesting and underliked method for the case when you don't want to keep the composer executable and cache files in your image.