Pipeline build on Self-hosted Runner fails with "Unable to run script in container and inspect it's state."
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
After configuring a new Bitbucket Self-hosted Runner and running the initial build, it is possible to encounter the following error under certain circumstances.
1
Unable to run script in container <container ID> and inspect it's state
This causes all builds executing on the Runner to fail with the error above.
Environment
Bitbucket Pipelines Self-hosted Runners, on any environment.
Cause
In Bitbucket Pipelines Self-hosted Runners, it is feasible to modify the working directory to a custom directory on the host machine by following the guidelines provided on the page below:
However, if the mounted directory paths (host and container mount directory in -v flag) and the working directory path on the container (-e WORKING_DIRECTORY=<dir> flag) do not match, the issue described on this page may arise.
The following bug ticket exists to monitor this issue:
Solution
Terminate or stop the Runner. This can be accomplished by using the keyboard shortcut Ctrl+C within the terminal that is actively executing the Runner on the host system.
To subsequently restart the Runner, it is crucial to reissue the startup command. Ensure that both the host and container volume, as well as the working directory path on the container, are consistent and match appropriately.
1
docker run [all existing parameters] -v /mydir:/mydir -e WORKING_DIRECTORY=/mydir
Was this helpful?