'Error: docker: Error response from daemon: hcsshim::CreateComputeSystem : The parameter is incorrect

I have Jenkins windows build agent connected to Jenkins master using cygwin ssh and when I run any windows docker containers on it locally it works completely fine, however when I run any Jenkins pipeline using that agent, the same container which used to run fine on the host does not run using the Jenkins job. I wonder if I need to pass any additional parameters in Jenkinsfile or set any path within the jenkins to make it work.

This is how my jenkinsfile look like.

roleArn           = 'arn:aws:iam::3*******7:role/jenkins-slave'
roleSessionName   = 'jenkins-slave-assume-role'
agent             = 'windows-agent'

pipeline {
    agent {
        label agent
    }
    
    stages {
        stage('Assume Role') {
            steps {
                script {
                    awsResponse  = sh(script: "aws sts assume-role --role-arn \"${roleArn}\" --role-session-name \"${roleSessionName}\"", returnStdout: true).trim()
                    responseJson = readJSON text: awsResponse
                    env.AWS_ACCESS_KEY_ID     = responseJson.Credentials.AccessKeyId
                    env.AWS_SECRET_ACCESS_KEY = responseJson.Credentials.SecretAccessKey
                    env.AWS_SESSION_TOKEN     = responseJson.Credentials.SessionToken
                }
            }
        }
        
        stage('ECR login') {
            steps {
                script {                    
                    bat "aws ecr get-login-password --region us-west-1 | docker login --username AWS --password-stdin 3*******7.dkr.ecr.us-west-1.amazonaws.com"
                }
            }
        }
        
        
        stage('Deployment to STG') {
            agent {
                docker {
                    label agent
                    image 'hello-world:latest'                                    
                }
            }
            steps {
                script {
                    bat '''
                        Write-Error 'Hello, World!'
                        '''                    
                }
            }
        }
        
    }
}

This is the error I keep getting,

java.io.IOException: Failed to run image '3******7.dkr.ecr.us-west-1.amazonaws.com/dotnet-framework-4.8-core:latest'. Error: docker: Error response from daemon: hcsshim::CreateComputeSystem f511622083983256fc845e97e335dbf65ee4e3ee287c89f1f5eb53a2bf08bd6d: The parameter is incorrect.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source