Terraform (through Jenkins) fails with error message "could not connect docker" While creating Azure Bastion

We trying to create a Azure Resource Group and resources on Azure through Terraform through Jenkins. We created Service Principal on Azure and Terraform (through Jenkins) authenticate by Service Principal. Terraform could create resources as expected, but fails with error message while creating Azure Bastion Host

"Cannot contact docker-xyz: hudson.remoting.ChannelClosedException: Channel “hudson.remoting.Channel@169c76e9:docker-xyz”: Remote call on docker-xyz failed. The channel is closing down or has closed down
Agent docker-xyz was deleted; cancelling node body
Could not connect to docker-xyz to send interrupt signal to process
[Pipeline] echo"

But the surprising part here is, Terraform could create Azure Bastion, added Subnet & Public IP Address to Bastion, but fails with above error message and CICD is NOT a successful deployment. What could be root cause and resolution? Please suggest. Below is the source code.

//Source Code
resource “azurerm_subnet” “azurebastionsubnet” {
name = “subnet-abc”
resource_group_name = “rg-abc”
virtual_network_name = “vnet-abc”
address_prefixes = [“x.x.x.x/25”]
service_endpoints =
enforce_private_link_endpoint_network_policies = true
enforce_private_link_service_network_policies = true

resource “azurerm_public_ip” “virtual_network_public_ip” {
name = “pip-abc”
resource_group_name = “rg-abc”
location = “Central US”
sku = “Standard”
allocation_method = “Static”

resource “azurerm_bastion_host” “virtual_network_bastion” {
name = “bastion-abc”
location = “Central US”
resource_group_name = “rg-abc”

ip_configuration {
name = “say abc-config”
subnet_id = “subnet-abc”
public_ip_address_id = azurerm_public_ip.virtual_network_public_ip.id

Hi @sandeepkumarvadde,

The mention of hudson.remoting.ChannelClosedException in this error message suggests that it’s a Jenkins error rather than a Terraform error, since “Hudson” is a former name for the open source project now called Jenkins.

Because of that, it might work better to ask this question in a Jenkins-related forum rather than in this Terraform forum, because it doesn’t seem like Terraform should be directly interacting with Docker at all in your situation and so the problem seems to be outside of Terraform.