We have a self-hosted Windows pipeline.
We are trying to run docker commands, e.g. docker build .
When we attempt to run this same command from terminal it works, but the pipeline runner instead gets this error:
+ docker build .DEPRECATED: The legacy builder is deprecated and will be removed in a future release.Install the buildx component to build images with BuildKit:error during connect: Post "http://localhost:2375/v1.54/build?dockerfile=myproject%2FDockerfile&t=myproject.azurecr.io%2Fmyproject&version=1": dial tcp [::1]:2375: connectex: No connection could be made because the target machine actively refused it.Hello @Jan Martin
First - Exposing 2375 - is Bananas. @Viswanathan Ramachandran
This error happens because Bitbucket Pipelines automatically injects a `DOCKER_HOST` variable, forcing Docker to look for a TCP connection on port 2375 instead of using the standard Windows named pipe.
Clear the variable at the start of your PowerShell script step using `$Env:DOCKER_HOST = ""` or set it explicitly to `"npipe:////./pipe/docker_engine"`. Avoid enabling TCP port 2375 in Docker Desktop as that creates an unnecessary security risk. If clearing the variable results in a permission error, run `whoami` in the step to verify that the Windows service account running your runner actually has access to Docker.
Here some reference from ancient Topic
Best,
Arek 🤠
My bad. I agree completely. I should have been more clearer. I'll just try to rule out the error and then remove again. Thank you for the mention and pointing out the reference article
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All fine. I just wanna point that Exposing ports is never good idea
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Jan Martin
The issue looks like a protocol/port mismatch between the Bitbucket Runner and Docker. Can you try one of these approaches:
Option A: Switch to Windows Named Pipes
You can explicitly force the runner to use the Windows Named Pipe by setting the DOCKER_HOST environment variable in your bitbucket-pipelines.yml
Option B : Enable TCP 2375 on Docker Daemon (not recommended)
alternatively, just checking, I hope your permissions are alright and set correctly?
May be you run the Bitbucket Runner service as the same user running Docker Desktop, or try switching to Docker Engine Service.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.