Bitbucket Cloud: Troubleshooting "Canceled While Waiting for Connection" Error in Docker-Based Kubernetes Runners
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
One may encounter the following error either while setting up Kubernetes runners, or while executing the build setup step:

Cause
Several factors may contribute to the occurrence of the "canceled while waiting for connection" error, including:
Slow network connection, Firewall, or proxy issues: The timeout may have occurred due to a slow or unstable network connection, or, it could be a firewall/proxy that is blocking the request and resulting in a timeout error.
Solution
As stated in the docker-based kubernetes runners documentation, we use the following Kubernetes objects to set up the Docker-based Kubernetes runners:
Secret: A Kubernetes Secret resource that is used to store sensitive data such as the OAuth client ID and secret.
Job: A Kubernetes Job resource that defines a set of pods to be run to completion. This job with the name "runner" defines a container specification with two containers - "runner" and "docker-in-docker".
The "runner" container runs the Atlassian Bitbucket Pipelines runner image and mounts several volumes, including tmp, docker containers, and var-run. The "docker-in-docker" container runs the Docker daemon and is used to run Docker commands within the "runner" container. It also mounts the same volumes as the "runner" container. The runner container uses the
docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner
image to start the runner, and the docker daemon container uses thedocker:20.10.5-dind
image to execute the build steps using the build containers.
Troubleshooting:
If Docker is locally installed, manually pull the Docker image or create a sample Kubernetes pod deployment to ensure it works without errors.
If the server is behind a firewall, allowlist IPs associated with docker-public.packages.atlassian.com and docker.io.
If behind a proxy, pass the proxy as variables for runners and Docker pods in the Kubernetes object spec.
Example:
Kubernetes object spec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
containers: - name: bitbucket-k8s-runner image: docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner env: - name: HTTP_PROXY value: "<PROXY URL>" - name: HTTPS_PROXY value: "<PROXY URL>" - name: docker-in-docker image: docker:20.10.7-dind imagePullPolicy: IfNotPresent env: - name: HTTP_PROXY value: "<PROXY URL>" - name: HTTPS_PROXY value: "<PROXY URL>"
Was this helpful?