Docker sometimes has issues with DNS resolution This isn't helped by a terrible network infrastructure So sometimes you get
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@hostname/repo.git/': Couldn't resolve host 'hostname'
So you want to add the host to the /etc/hosts file. First idea to specify your own dns doesn't work.
Instead, you want to add something to /etc/hosts: