Can't clone repo within a pipeline that runs on a self hosted runner
Asked by Rafael Soares Pinto:

Hi!  

I'm having a hard time understanding an issue that happens when I run a pipeline on a self hosted (linux) runner.  

I get the following problem during the \`Build setup\`,  

\`\`\`

    ?Cloning into '/opt/atlassian/pipelines/agent/build'...

    fatal: unable to access 'https://bitbucket.org/carrefour_ecommerce/test-pipeline-execution.git/': Recv failure: Connection reset by peer

\`\`\`

I've checked that I have access to internet (can curl to bitbucket and atlassian sites without a problem)


Answers:
author: Patrik S
body: Hello [@Rafael Soares Pinto](/t5/user/viewprofilepage/user-id/5352944) and welcome to the Community!

Based on the error message you received, this seems to be a connectivity issue from the runner's host to Atlassian infrastructure.

This is usually caused if your runner's host is behind a firewall/proxy that is blocking the connection to Atlassian.

In this case, I would suggest you confirm if all the IPs listed in [Valid IP addresses for bitbucket.org](https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-bitbucket.org--api.bitbucket.org--and-altssh.bitbucket.org) are allowed in the firewall, as the connection to those IPs is necessary for the self-hosted runner to clone the repository.

You can also try executing the runner in a different machine/network (your personal laptop, for example) and check if the same error happens.

Let us know in case you have any questions.

Thank you, [@Rafael Soares Pinto](/t5/user/viewprofilepage/user-id/5352944) !

Patrik S


author: Rafael Soares Pinto
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ! Thanks for you answer!  

Using the same VM I switched to use the linux shell and it works perfectly, but I don't know why it did not work for docker runner.  

I'm trying to host the runner on a google compute instance. Previously I used the command  

\`\`\`  
docker container run \\  
-v /tmp:/tmp \\  
-v /var/run/docker.sock:/var/run/docker.sock \\  
-v /var/lib/docker/containers:/var/lib/docker/containers:ro \\  
-e ACCOUNT_UUID={${ACCOUNT_UUID}} \\  
-e RUNNER_UUID={${RUNNER_ID}} \\  
-e RUNTIME_PREREQUISITES_ENABLED=true \\  
-e OAUTH_CLIENT_ID=${OAUTH_CLIENT_ID} \\  
-e OAUTH_CLIENT_SECRET=${OAUTH_CLIENT_SECRET} \\  
--name runner-${RUNNER_ID} \\  
-e WORKING_DIRECTORY=/tmp docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1  
\`\`\`  
but it returned me the error i mentioned earlier. I'm a little lost on this issue. Do I need to do an extra configuration on the compute instance?

comments: author: Patrik S
body: Hello [@Rafael Soares Pinto](/t5/user/viewprofilepage/user-id/5352944) ,

I'm not very familiar with the Google compute instance configuration, but this would lead me to believe a firewall (see [Google VPC firewall](https://cloud.google.com/firewall/docs/using-firewalls)) is blocking the connection to [Valid Bitbucket.org IP addresses](https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-bitbucket.org--api.bitbucket.org--and-altssh.bitbucket.org). Interesting though that with the shell runners in the same environment it did work.

Could you confirm if the host machine meets all the requirements listed in [Prerequisites for linux docker runners](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-runners-for-linux/#Prerequisites) ?

Also, if you try to execute the Linux docker runner on a different machine (outside of GCloud), does the same issue happen?


author: Rafael Soares Pinto
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)  

I have found this issue only when executing the runner within GCLoud. When I run it on my personal notebook, it works without a problem. I also checked that all the prerequisites are satisfied.


Tags: bitbucket-cloud

bitbucket-pipelines

cloud