Hello Atlassian Community,
I am facing an issue when trying to run a Windows Docker container inside a Bitbucket Self hosted Windows Runner. The problem is that the Docker container gets stuck while executing the docker run command, and after some time, the runner goes into an unhealthy state. I need to restart the runner to recover from this situation. It is strange because it's only happening with this particular container, I have similar workflows for other Windows Based Containers for Building Python GUI applications and they work smoothly with Bitbucket Pipeline Windows Runner.
Here are the details of my setup:
Pipeline Configuration: (It looks something like this)
clone:
lfs: true
pipelines:
pull-requests: '**':
- step:
name: "Build a Rust package using Maturin on Windows Server 2022 VM"
runs-on:
- 'self.hosted'
- 'windows'
- 'server.2022'
script: - $env:DOCKER_HUB_PASSWORD | docker login -u $env:DOCKER_HUB_USERNAME --password-stdin
- docker ps
- docker images
- docker pull private-registry/repo:rust_python_win_2022_container
- >
docker
run
-e ENV_ONE="$env:ENV_ONE"
-e ENV_TWO="$env:ENV_TWO"
-v ${PWD}:/internal_dir_where_entrypoint.ps1
private-registry/repo:rust_python_win_2022_container
after-script:
- docker logout
- docker system prune -f
- docker container prune -f
- docker image prune -f
- docker volume prune -f
- docker network prune -f
The Docker container is a Windows container with a mixed Python & Rust environment.
My questions are:
- How can I prevent the runner from going into an unhealthy state on Windows?
- Is there a timeline for Windows-based Docker containers to be supported on Bitbucket Pipelines?
- What are some suggested alternatives to run Windows Docker containers on Bitbucket Pipelines? (We have already considered Bamboo, but it is out of our budget. We can consider Jenkins, but it does not have very good end-to-end integrations like Bitbucket Pipelines).
Additionally, why does Bitbucket Pipelines freeze and cause the runner to go into an unhealthy state?
FYI : I had a similar issue on the Self hosted Linux Shell Runner trying to run Rust based Docker container and it went into an unhealthy state after finishing running the pipeline. I had to then manually delete the log files in the temp directory and restart the runner to get it back up again. My best guess based on reading the logs is that this happens due to permission issue as Linux Shell docker runner does not run with super user privileges and isn't in the same group as the docker installation on the Linux machine. But I doubt this might be the case on the Windows Runner as it runs in the Administrative PowerShell by default.
Any help or hint is appreciated.
Thank you for your assistance!
Best regards,
Gajesh