microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.5k stars 2.61k forks source link

[BUG]: Unable to find 'docker' with agent version 3.218.0 #18039

Closed MariusGrandeAndersen closed 1 year ago

MariusGrandeAndersen commented 1 year ago

Task name

Docker@2

Task version

2.214.0

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Windows 2022

Task log

Starting: Build the image
==============================================================================
Task         : Docker
Description  : Build or push Docker images, login or logout, start or stop containers, or run a Docker command
Version      : 2.214.0
Author       : Microsoft Corporation
Help         : https://aka.ms/azpipes-docker-tsg
==============================================================================
##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
Finishing: Build the image

Relevant log output

##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

Aditional info

2.217.2 agent version build worked ok. Same Docker@2 version as the one that failed: 2.214.0

Our agent pool updated automatically to 3.218.0 today, and my theory is that this is what broke this. 
This is breaking our windows pipelines.
ivanduplenskikh commented 1 year ago

@MariusGrandeAndersen, could you make a bash script step with docker --version and share pipeline logs in debug mode to take a look? You can retrieve them by following docs . To set up debug (verbose) mode - you can use the options described here.

Also, I noticed a duplicate https://github.com/microsoft/azure-pipelines-agent/issues/4219, can I close it?

MariusGrandeAndersen commented 1 year ago

Yes you can close it. I was unsure where the correct spot to report this was.

Remember, this is Windows, so I ran a Powershell task

- task: PowerShell@2
    displayName: 'docker --version'
    inputs:
      targetType: 'inline'
      script: |
        docker --version
        Write-Host "docker --version"

this fails with

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\a\_temp\7b99e721-383c-4b58-a15f-77e651176072.ps1'"
docker : The term 'docker' is not recognized as the name of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\a\_temp\7b99e721-383c-4b58-a15f-77e651176072.ps1:4 char:1
+ docker --version
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (docker:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

I will send the parts I am assumed you are interested in, as this is quite a big pipeline,

Initialize job:

2023-03-29T15:25:33.4567568Z ##[section]Starting: Initialize job
2023-03-29T15:25:33.4568157Z Agent name: 'winvmss00008B'
2023-03-29T15:25:33.4568439Z Agent machine name: 'winvmss00008B'
2023-03-29T15:25:33.4568575Z Current agent version: '3.218.0'
2023-03-29T15:25:33.4586357Z Agent running as: 'AzDevOps'
2023-03-29T15:25:33.4624297Z ##[debug]Triggering repository: product. repository type: Git
2023-03-29T15:25:33.4628508Z Prepare build directory.
2023-03-29T15:25:33.4924095Z ##[debug]Delete existing build directory: 'C:\a\1'
2023-03-29T15:25:33.4926259Z ##[debug]Deleting build directory: 'C:\a\1'
2023-03-29T15:25:33.5137713Z ##[debug]Creating build directory: 'C:\a\1'
2023-03-29T15:25:33.5139572Z ##[debug]Delete existing artifacts directory: 'C:\a\1\a'
2023-03-29T15:25:33.5139951Z ##[debug]Creating artifacts directory: 'C:\a\1\a'
2023-03-29T15:25:33.5141169Z ##[debug]Delete existing test results directory: 'C:\a\1\TestResults'
2023-03-29T15:25:33.5141547Z ##[debug]Creating test results directory: 'C:\a\1\TestResults'
2023-03-29T15:25:33.5142800Z ##[debug]Creating binaries directory: 'C:\a\1\b'
2023-03-29T15:25:33.5143966Z ##[debug]Creating source directory: 'C:\a\1\s'
2023-03-29T15:25:33.5192030Z Set build variables.
2023-03-29T15:25:33.5214912Z Download all required tasks.
2023-03-29T15:25:33.5314373Z ##[debug]Task 'DownloadBuildArtifacts' already downloaded at 'C:\a\_tasks\DownloadBuildArtifacts_a433f589-fce1-4460-9ee6-44a624aeb1fb\0.217.1'.
2023-03-29T15:25:33.5315360Z ##[debug]Task 'CopyFiles' already downloaded at 'C:\a\_tasks\CopyFiles_5bfb729a-a7c8-4a78-a7c3-8d717bb7c13c\2.211.0'.
2023-03-29T15:25:33.5316239Z ##[debug]Task 'PowerShell' already downloaded at 'C:\a\_tasks\PowerShell_e213ff0f-5d5c-4791-802d-52ea3e7be1f1\2.212.0'.
2023-03-29T15:25:33.5317093Z ##[debug]Task 'Docker' already downloaded at 'C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0'.
2023-03-29T15:25:33.5373431Z Checking job knob settings.
2023-03-29T15:25:33.5380561Z    Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES) 
2023-03-29T15:25:33.5382184Z    Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT) 
2023-03-29T15:25:33.5382507Z Finished checking job knob settings.
2023-03-29T15:25:33.5633403Z ##[debug]Log plugin 'TestResultLogPlugin' is disabled.
2023-03-29T15:25:33.5633664Z ##[debug]Log plugin 'TestFilePublisherPlugin' is disabled.
2023-03-29T15:25:33.5633919Z Start tracking orphan processes.
2023-03-29T15:25:33.5677176Z ##[section]Finishing: Initialize job

Docker task:

2023-03-29T15:27:11.6664126Z ##[debug]Evaluating condition for step: 'Build the image'
2023-03-29T15:27:11.6664812Z ##[debug]Evaluating: SucceededNode()
2023-03-29T15:27:11.6664994Z ##[debug]Evaluating SucceededNode:
2023-03-29T15:27:11.6665310Z ##[debug]=> True
2023-03-29T15:27:11.6665514Z ##[debug]Result: True
2023-03-29T15:27:11.6665716Z ##[section]Starting: Build the image
2023-03-29T15:27:11.6737972Z ==============================================================================
2023-03-29T15:27:11.6738132Z Task         : Docker
2023-03-29T15:27:11.6738202Z Description  : Build or push Docker images, login or logout, start or stop containers, or run a Docker command
2023-03-29T15:27:11.6738337Z Version      : 2.214.0
2023-03-29T15:27:11.6738405Z Author       : Microsoft Corporation
2023-03-29T15:27:11.6738500Z Help         : https://aka.ms/azpipes-docker-tsg
2023-03-29T15:27:11.6738592Z ==============================================================================
2023-03-29T15:27:11.7181861Z ##[debug]Using node path: C:\agent\externals\node16\bin\node.exe
2023-03-29T15:27:11.8140093Z ##[debug]agent.TempDirectory=C:\a\_temp
2023-03-29T15:27:11.8151850Z ##[debug]loading inputs and endpoints
2023-03-29T15:27:11.8157643Z ##[debug]loading ENDPOINT_AUTH_b2102595-6afd-46d6-aa15-5cce06cd372b
2023-03-29T15:27:11.8168342Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_b2102595-6afd-46d6-aa15-5cce06cd372b_PASSWORD
2023-03-29T15:27:11.8170696Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_b2102595-6afd-46d6-aa15-5cce06cd372b_REGISTRY
2023-03-29T15:27:11.8172793Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_b2102595-6afd-46d6-aa15-5cce06cd372b_USERNAME
2023-03-29T15:27:11.8174848Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2023-03-29T15:27:11.8177011Z ##[debug]loading ENDPOINT_AUTH_SCHEME_b2102595-6afd-46d6-aa15-5cce06cd372b
2023-03-29T15:27:11.8179977Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2023-03-29T15:27:11.8182242Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2023-03-29T15:27:11.8185413Z ##[debug]loading INPUT_ADDBASEIMAGEDATA
2023-03-29T15:27:11.8188250Z ##[debug]loading INPUT_ADDPIPELINEDATA
2023-03-29T15:27:11.8191433Z ##[debug]loading INPUT_ARGUMENTS
2023-03-29T15:27:11.8194607Z ##[debug]loading INPUT_BUILDCONTEXT
2023-03-29T15:27:11.8197641Z ##[debug]loading INPUT_COMMAND
2023-03-29T15:27:11.8200529Z ##[debug]loading INPUT_CONTAINERREGISTRY
2023-03-29T15:27:11.8202429Z ##[debug]loading INPUT_DOCKERFILE
2023-03-29T15:27:11.8204226Z ##[debug]loading INPUT_REPOSITORY
2023-03-29T15:27:11.8206001Z ##[debug]loading INPUT_TAGS
2023-03-29T15:27:11.8208915Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2023-03-29T15:27:11.8213715Z ##[debug]loaded 18
2023-03-29T15:27:11.8219211Z ##[debug]Agent.ProxyUrl=undefined
2023-03-29T15:27:11.8219883Z ##[debug]Agent.CAInfo=undefined
2023-03-29T15:27:11.8220411Z ##[debug]Agent.ClientCert=undefined
2023-03-29T15:27:11.8221477Z ##[debug]Agent.SkipCertValidation=undefined
2023-03-29T15:27:11.8491127Z ##[debug]check path : C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\node_modules\azure-pipelines-tasks-docker-common-v2\module.json
2023-03-29T15:27:11.8492454Z ##[debug]adding resource file: C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\node_modules\azure-pipelines-tasks-docker-common-v2\module.json
2023-03-29T15:27:11.8493518Z ##[debug]system.culture=en-US
2023-03-29T15:27:11.8494341Z ##[debug]Resource file has already set to: C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\node_modules\azure-pipelines-tasks-docker-common-v2\module.json
2023-03-29T15:27:11.8676304Z ##[debug]agent.proxyurl=undefined
2023-03-29T15:27:11.8677080Z ##[debug]VSTS_ARM_REST_IGNORE_SSL_ERRORS=undefined
2023-03-29T15:27:11.8677742Z ##[debug]AZURE_HTTP_USER_AGENT=VSTS_9b320939-b8a5-478a-b4d3-1e10b73aeadf_build_649_0
2023-03-29T15:27:11.8827115Z ##[debug]check path : C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\node_modules\azure-pipelines-tasks-azure-arm-rest-v2\module.json
2023-03-29T15:27:11.8829389Z ##[debug]adding resource file: C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\node_modules\azure-pipelines-tasks-azure-arm-rest-v2\module.json
2023-03-29T15:27:11.8830125Z ##[debug]system.culture=en-US
2023-03-29T15:27:11.8888443Z ##[debug]check path : C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\task.json
2023-03-29T15:27:11.8889238Z ##[debug]adding resource file: C:\a\_tasks\Docker_e28912f1-0114-4464-802a-a3a35437fd16\2.214.0\task.json
2023-03-29T15:27:11.8889885Z ##[debug]system.culture=en-US
2023-03-29T15:27:11.8901395Z ##[debug]containerRegistry=b2102595-6afd-46d6-aa15-5cce06cd372b
2023-03-29T15:27:11.8904031Z ##[debug]b2102595-6afd-46d6-aa15-5cce06cd372b data registrytype = Others
2023-03-29T15:27:11.8906531Z ##[debug]b2102595-6afd-46d6-aa15-5cce06cd372b exists true
2023-03-29T15:27:11.8907425Z ##[debug]System.ServerType=Hosted
2023-03-29T15:27:11.8914886Z ##[debug]command=build
2023-03-29T15:27:11.8917042Z ##[debug]which 'docker'
2023-03-29T15:27:11.8959431Z ##[debug]not found
2023-03-29T15:27:11.8966375Z ##[debug]task result: Failed
2023-03-29T15:27:11.8997233Z ##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9003951Z ##[debug]Processed: ##vso[task.issue type=error;]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9005702Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9006498Z ##[debug]task result: Failed
2023-03-29T15:27:11.9007521Z ##[error]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9008182Z ##[debug]Processed: ##vso[task.issue type=error;]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9009272Z ##[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Unable to locate executable file: 'docker'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.
2023-03-29T15:27:11.9047707Z ##[section]Finishing: Build the image
ivanduplenskikh commented 1 year ago

Are these logs a self-hosted or Microsoft-hosted agent? The Docker task does not install Docker as a dependency. If it is a self-hosted agent could you please double-check the installed docker?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days

d4nish30 commented 11 months ago

[debug]Evaluating condition for step: 'Login to Amazon ECR'

[debug]Evaluating: success()

[debug]Evaluating success:

[debug]=> true

[debug]Result: true

[debug]Starting: Login to Amazon ECR

[debug]Register post job cleanup for action: aws-actions/amazon-ecr-login@v2

[debug]Loading inputs

[debug]Loading env

Run aws-actions/amazon-ecr-login@v2 /usr/bin/docker exec 9f5c523b7a055691750b98b48904d316ea1d1486dfa5f3869beccbf910cca39f sh -c "cat /etc/*release | grep ^ID"

[debug]ID=alpine

[debug]Container distribution is alpine. Running JavaScript Action with external tool: node20_alpine

Logging into registry 328798424567.dkr.ecr.eu-north-1.amazonaws.com Error: Unable to locate executable file: docker. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.

[debug]Node Action run completed with exit code 1

[debug]Set output registry = 328798424567.dkr.ecr.eu-north-1.amazonaws.com

[debug]Finishing: Login to Amazon ECR

please give solution for this issue