cli: docker: Error response from daemon: the working directory ... is invalid, it needs to be an absolute path.

Description

docker CLI reports error docker: Error response from daemon: the working directory ‘…’ is invalid, it needs to be an absolute path.

Steps to reproduce the issue:

  1. Use docker CLI on Windows for Windows containers

  2. Run

    docker run --rm -w c:\buildagenttemp\work\9d55fd57e39bb0f1 --label jetbrains.teamcity.buildId=88773 -v C:\BuildAgentTemp\lib:c:\buildagenttemp\lib:ro -v C:\BuildAgentTemp\tools:c:\buildagenttemp\tools:ro -v C:\BuildAgentTemp\plugins:c:\buildagenttemp\plugins:ro -v C:\BuildAgentTemp\work\9d55fd57e39bb0f1:c:\buildagenttemp\work\9d55fd57e39bb0f1 -v C:\BuildAgentTemp\temp\agentTmp:c:\buildagenttemp\temp\agenttmp -v C:\BuildAgentTemp\temp\buildTmp:c:\buildagenttemp\temp\buildtmp -v C:\BuildAgentTemp\system:c:\buildagenttemp\system --env-file C:\BuildAgentTemp\temp\agentTmp\docker-wrapper-2148898113150322058.envList --platform windows --entrypoint cmd microsoft/dotnet:sdk /c c:\buildagenttemp\temp\agenttmp\docker-shell-script-1350818394170698921.cmd
    
  3. docker CLI reports docker: Error response from daemon: the working directory 'c:\buildagenttemp\work\9d55fd57e39bb0f1' is invalid, it needs to be an absolute path. See 'docker run --help'.

Describe the results you received:

docker: Error response from daemon: the working directory 'c:\buildagenttemp\work\9d55fd57e39bb0f1' is invalid, it needs to be an absolute path. See 'docker run --help'.

Process exited with code 125

Describe the results you expected:

Everything should be ok there

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Docker version 19.03.5, build 633a0ea

Output of docker info:

Client:
[13:23:15][Step 1/2]  Debug Mode: false
[13:23:15][Step 1/2]  Plugins:
[13:23:15][Step 1/2]   app: Docker Application (Docker Inc., v0.8.0)
[13:23:15][Step 1/2]   buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)
[13:23:15][Step 1/2] 
[13:23:15][Step 1/2] Server:
[13:23:15][Step 1/2]  Containers: 36
[13:23:15][Step 1/2]   Running: 0
[13:23:15][Step 1/2]   Paused: 0
[13:23:15][Step 1/2]   Stopped: 36
[13:23:15][Step 1/2]  Images: 426
[13:23:15][Step 1/2]  Server Version: 19.03.5
[13:23:15][Step 1/2]  Storage Driver: windowsfilter (windows) lcow (linux)
[13:23:15][Step 1/2]   Windows: 
[13:23:15][Step 1/2]   LCOW: 
[13:23:15][Step 1/2]  Logging Driver: json-file
[13:23:15][Step 1/2]  Plugins:
[13:23:15][Step 1/2]   Volume: local
[13:23:15][Step 1/2]   Network: ics internal l2bridge l2tunnel nat null overlay private transparent
[13:23:15][Step 1/2]   Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog
[13:23:15][Step 1/2]  Swarm: inactive
[13:23:15][Step 1/2]  Default Isolation: hyperv
[13:23:15][Step 1/2]  Kernel Version: 10.0 17763 (17763.1.amd64fre.rs5_release.180914-1434)
[13:23:15][Step 1/2]  Operating System: Windows 10 Pro Version 1809 (OS Build 17763.864)
[13:23:15][Step 1/2]  OSType: windows
[13:23:15][Step 1/2]  Architecture: x86_64
[13:23:15][Step 1/2]  CPUs: 8
[13:23:15][Step 1/2]  Total Memory: 15.83GiB
[13:23:15][Step 1/2]  Name: docker-note
[13:23:15][Step 1/2]  ID: X25Y:O5A7:NLT6:SO75:3RHB:B4OS:4WN4:OKJE:N2O5:OWPZ:5BIE:5K42
[13:23:15][Step 1/2]  Docker Root Dir: C:\ProgramData\Docker
[13:23:15][Step 1/2]  Debug Mode: true
[13:23:15][Step 1/2]   File Descriptors: -1
[13:23:15][Step 1/2]   Goroutines: 38
[13:23:15][Step 1/2]   System Time: 2019-11-22T11:23:14.6613407+01:00
[13:23:15][Step 1/2]   EventsListeners: 6
[13:23:15][Step 1/2]  Registry: https://index.docker.io/v1/
[13:23:15][Step 1/2]  Labels:
[13:23:15][Step 1/2]  Experimental: true
[13:23:15][Step 1/2]  Insecure Registries:
[13:23:15][Step 1/2]   docker-registry.labs.intellij.net
[13:23:15][Step 1/2]   nexus-test.labs.intellij.net:8888
[13:23:15][Step 1/2]   tcqa-registry.labs.intellij.net
[13:23:15][Step 1/2]   tcqa-registry.labs.intellij.net:5000
[13:23:15][Step 1/2]   127.0.0.0/8
[13:23:15][Step 1/2]  Live Restore Enabled: false
[13:23:15][Step 1/2]  Product License: Community Engine

Additional environment details (AWS, VirtualBox, physical, etc.):

Host:

[13:23:17][Step 1/2] Host Name:                 DOCKER-NOTE
[13:23:17][Step 1/2] OS Name:                   Microsoft Windows 10 Pro
[13:23:17][Step 1/2] OS Version:                10.0.17763 N/A Build 17763
[13:23:17][Step 1/2] OS Manufacturer:           Microsoft Corporation
[13:23:17][Step 1/2] OS Configuration:          Standalone Workstation
[13:23:17][Step 1/2] OS Build Type:             Multiprocessor Free
[13:23:17][Step 1/2] Registered Owner:          N/A
[13:23:17][Step 1/2] Registered Organization:   N/A
[13:23:17][Step 1/2] Product ID:                00330-71336-18686-AAOEM
[13:23:17][Step 1/2] Original Install Date:     3/7/2019, 5:53:39 PM
[13:23:17][Step 1/2] System Boot Time:          11/19/2019, 11:14:33 AM
[13:23:17][Step 1/2] System Manufacturer:       Dell Inc.
[13:23:17][Step 1/2] System Model:              XPS 15 9560
[13:23:17][Step 1/2] System Type:               x64-based PC
[13:23:17][Step 1/2] Processor(s):              1 Processor(s) Installed.
[13:23:17][Step 1/2]                            [01]: Intel64 Family 6 Model 158 Stepping 9 GenuineIntel ~2801 Mhz
[13:23:17][Step 1/2] BIOS Version:              Dell Inc. 1.5.0, 8/30/2017
[13:23:17][Step 1/2] Windows Directory:         C:\WINDOWS
[13:23:17][Step 1/2] System Directory:          C:\WINDOWS\system32
[13:23:17][Step 1/2] Boot Device:               \Device\HarddiskVolume1
[13:23:17][Step 1/2] System Locale:             en-us;English (United States)
[13:23:17][Step 1/2] Input Locale:              en-us;English (United States)
[13:23:17][Step 1/2] Time Zone:                 (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
[13:23:17][Step 1/2] Total Physical Memory:     16,205 MB
[13:23:17][Step 1/2] Available Physical Memory: 9,741 MB
[13:23:17][Step 1/2] Virtual Memory: Max Size:  18,637 MB
[13:23:17][Step 1/2] Virtual Memory: Available: 6,721 MB
[13:23:17][Step 1/2] Virtual Memory: In Use:    11,916 MB
[13:23:17][Step 1/2] Page File Location(s):     C:\pagefile.sys
[13:23:17][Step 1/2] Domain:                    WORKGROUP
[13:23:17][Step 1/2] Logon Server:              \\DOCKER-NOTE
[13:23:17][Step 1/2] Hotfix(s):                 15 Hotfix(s) Installed.
[13:23:17][Step 1/2]                            [01]: KB4515843
[13:23:17][Step 1/2]                            [02]: KB4465065
[13:23:17][Step 1/2]                            [03]: KB4470788
[13:23:17][Step 1/2]                            [04]: KB4480056
[13:23:17][Step 1/2]                            [05]: KB4486153
[13:23:17][Step 1/2]                            [06]: KB4493510
[13:23:17][Step 1/2]                            [07]: KB4499728
[13:23:17][Step 1/2]                            [08]: KB4504369
[13:23:17][Step 1/2]                            [09]: KB4509095
[13:23:17][Step 1/2]                            [10]: KB4512577
[13:23:17][Step 1/2]                            [11]: KB4512937
[13:23:17][Step 1/2]                            [12]: KB4516115
[13:23:17][Step 1/2]                            [13]: KB4521862
[13:23:17][Step 1/2]                            [14]: KB4523204
[13:23:17][Step 1/2]                            [15]: KB4523205
[13:23:17][Step 1/2] Network Card(s):           5 NIC(s) Installed.
[13:23:17][Step 1/2]                            [01]: Hyper-V Virtual Ethernet Adapter
[13:23:17][Step 1/2]                                  Connection Name: vEthernet (Default Switch)
[13:23:17][Step 1/2]                                  DHCP Enabled:    No
[13:23:17][Step 1/2]                                  IP address(es)
[13:23:17][Step 1/2]                                  [01]: 172.17.225.113
[13:23:17][Step 1/2]                                  [02]: fe80::7f:6717:e099:c848
[13:23:17][Step 1/2]                            [02]: Hyper-V Virtual Ethernet Adapter
[13:23:17][Step 1/2]                                  Connection Name: vEthernet (nat)
[13:23:17][Step 1/2]                                  DHCP Enabled:    No
[13:23:17][Step 1/2]                                  IP address(es)
[13:23:17][Step 1/2]                                  [01]: ***
[13:23:17][Step 1/2]                                  [02]: ***
[13:23:17][Step 1/2]                            [03]: Bluetooth Device (Personal Area Network)
[13:23:17][Step 1/2]                                  Connection Name: Bluetooth Network Connection 2
[13:23:17][Step 1/2]                                  Status:          Media disconnected
[13:23:17][Step 1/2]                            [04]: Microsoft KM-TEST Loopback Adapter
[13:23:17][Step 1/2]                                  Connection Name: Npcap Loopback Adapter
[13:23:17][Step 1/2]                                  DHCP Enabled:    Yes
[13:23:17][Step 1/2]                                  DHCP Server:     255.255.255.255
[13:23:17][Step 1/2]                                  IP address(es)
[13:23:17][Step 1/2]                                  [01]: ***
[13:23:17][Step 1/2]                                  [02]: ***
[13:23:17][Step 1/2]                            [05]: Killer Wireless-n/a/ac 1535 Wireless Network Adapter
[13:23:17][Step 1/2]                                  Connection Name: Wi-Fi
[13:23:17][Step 1/2]                                  DHCP Enabled:    Yes
[13:23:17][Step 1/2]                                  DHCP Server:     ***
[13:23:17][Step 1/2]                                  IP address(es)
[13:23:17][Step 1/2]                                  [01]: ***
[13:23:17][Step 1/2]                                  [02]: ***

Related issue: https://youtrack.jetbrains.com/issue/TW-62945

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 30 (6 by maintainers)

Most upvoted comments

If you have Git Bash installed, you’re hitting Mingw/msys2’s POSIX path conversion feature; see https://github.com/docker/docker.github.io/issues/10912 and https://github.com/docker/for-win/issues/6754#issuecomment-629702199

This is due to Mingw/msys2 doing automatic path conversion; see http://www.mingw.org/wiki/Posix_path_conversion

You can disable this by prefixing paths with // or setting the MSYS_NO_PATHCONV=1 environment variable (see https://stackoverflow.com/a/34386471)

Because this path conversion happens before docker receives the value, its not something we can fix in docker.

I just installed the Windows 10 2004 update, so that I could install Docker Desktop. I am following the onboarding tutorial, but now I am running into the same issue.

Apparently, this is because I am using Git Bash. I already has an issue before, when logging in to Docker Hub, and then could solve it by using winpty, but that did not help in this case.

I finally got it working by using PowerShell to execute the docker command instead. For some reason, then it does not complain about the working directory… Not the solution I was looking for, because I’d like to keep using Git Bash.

To get this working in GitBash I used:

docker run -p 8082:3000 -v /e:/development/docker/ExpressSite://var/www -w “//var/www” node npm start

I have a nodeJs site in the E: development docker ExpressSite folder which I wanted to mount as a volume in the container as /var/www and setting the working directory “-w” to /var/www. Using the above command line got this working.

Run it with PowerShell. Solved for me.

Win 7 x64, Docker Toolbox 19.03.1: for me solution was to add extra / to all paths something like this:

winpty docker run --rm -v //h/X_progs/Y_progs:/src -w //src -it <image> //bin/bash

encounter the sa problem using gitbash under win10, this works for me!

What should I do to resolve Absolute path Issue?

I ran into the problem when attempting to run a docker command in git bash with $(pwd) passed as an argument. What happens, is that somehow it resolves to the Git folder in your Program files, instead of your Currently working directory. Try running the command on powershell, worked for me as it did for @piccolorio

It worked for me by applying a double slash at the beginning of the working directory route and at the beginning of the host route.

I leave an example

docker container run --name test -w //app -p 3000:3000 -v "\\c\users\desktop\nest-graphql"://app node:20

Win 7 x64, Docker Toolbox 19.03.1: for me solution was to add extra / to all paths something like this:

winpty docker run --rm -v //h/X_progs/Y_progs:/src -w //src -it <image> //bin/bash

@Aravindyadhav your comment doesn’t show the command you used to create / run the container, only a docker inspect ? From the error, I suspect you tried to set a Windows directory as working-directory for inside a Linux container (which won’t work).

What should I do to resolve Absolute path Issue?

@thaJeztah : So whats the solution here mate? I am also having the same Issue but your answer doesnt seems to help. I have docker toolbox on my windows10 machine Installed and I am trying to build aan image from Dockerfile:

Docker file FROM openjdk:8

Install Maven

RUN apt-get update && \apt-get install -y maven && \apt-get clean

Install Chrome

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install

install chromedriver

RUN apt-get install -yqq unzip RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

ANd I see the following error below:

Started by user Nouman Arshad Syed Running in Durability level: MAX_SURVIVABILITY [Pipeline] Start of Pipeline [Pipeline] node Running on Jenkins in C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile [Pipeline] { [Pipeline] stage [Pipeline] { (Declarative: Agent Setup) [Pipeline] isUnix [Pipeline] readFile [Pipeline] sh

  • docker build -t 82a982ee9eb919eaaceda17983edb7a18f53740b -f Dockerfile . Sending build context to Docker daemon 3.502MB

Step 1/8 : FROM openjdk:8 —> cdf26cc71b50 Step 2/8 : RUN apt-get update && \apt-get install -y maven && \apt-get clean —> Using cache —> 81918bded072 Step 3/8 : RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb —> Using cache —> c37c46e62d30 Step 4/8 : RUN dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install —> Using cache —> e6481b1814f9 Step 5/8 : RUN apt-get install -yqq unzip —> Using cache —> 2f4eb956be91 Step 6/8 : RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip —> Using cache —> 507db1014069 Step 7/8 : RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/ —> Using cache —> 5fe745df9225 Step 8/8 : WORKDIR /windows/system32 —> Running in e28d11307660 Removing intermediate container e28d11307660 —> 9aa3533daf4e Successfully built 9aa3533daf4e Successfully tagged 82a982ee9eb919eaaceda17983edb7a18f53740b:latest SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have ‘-rwxr-xr-x’ permissions. It is recommended to double check and reset permissions for sensitive files and directories. [Pipeline] dockerFingerprintFrom [Pipeline] } [Pipeline] // stage [Pipeline] sh

  • docker inspect -f . 82a982ee9eb919eaaceda17983edb7a18f53740b . [Pipeline] withDockerContainer Jenkins does not seem to be running inside a container $ docker run -t -d -u 197609:197121 -w “C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile” -v “C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile:C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile:rw,z” -v “C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile@tmp:C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile@tmp:rw,z” -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** 82a982ee9eb919eaaceda17983edb7a18f53740b cat [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.io.IOException: Failed to run image ‘82a982ee9eb919eaaceda17983edb7a18f53740b’. Error: docker: Error response from daemon: the working directory ‘C:\Users\Juveria Fatima.jenkins\workspace\Geb_Groovy_Pripeline_JenkinsFile’ is invalid, it needs to be an absolute path. See ‘docker run --help’. at org.jenkinsci.plugins.docker.workflow.client.DockerClient.run(DockerClient.java:133) at org.jenkinsci.plugins.docker.workflow.WithContainerStep$Execution.start(WithContainerStep.java:186) at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:286) at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:179) at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:20) at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:120) at org.jenkinsci.plugins.docker.workflow.Docker.node(Docker.groovy:66) at org.jenkinsci.plugins.docker.workflow.Docker$Image.inside(Docker.groovy:108) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.DockerPipelineFromDockerfileScript.runImage(DockerPipelineFromDockerfileScript.groovy:56) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.configureRegistry(AbstractDockerPipelineScript.groovy:73) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.AbstractDockerPipelineScript.run(AbstractDockerPipelineScript.groovy:52) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.checkoutAndRun(CheckoutScript.groovy:64) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.CheckoutScript.doCheckout(CheckoutScript.groovy:40) at org.jenkinsci.plugins.pipeline.modeldefinition.agent.impl.LabelScript.run(LabelScript.groovy:43) at cps.transform(Native Method) at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:84) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113) at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83) at sun.reflect.GeneratedMethodAccessor330.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46) at com.cloudbees.groovy.cps.Next.step(Next.java:83) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129) at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268) at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18) at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51) at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:186) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:370) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:93) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:282) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:270) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:66) at java.util.concurrent.FutureTask.run(Unknown Source) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Finished: FAILURE