How to access a gitlab private repository on docker build

I am doing a composer build within my dockerfile and I am unable to access the private repo in gitlab. Instead I get a generic “Could not authenticate against gitlab.com” when it tries to composer install