cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open NikolayPianikov opened this issue 4 years ago • 25 comments

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

NikolayPianikov avatar Nov 22 '19 10:11 NikolayPianikov

Hello @NikolayPianikov I also faced the same issue and resolved it Just need few inputs from ur end.

I would like to ask one question please don't mind:

Which command line interface are you using: CMD, Gitbash (Particulary linux based) ?

Thank you

abhishek09091 avatar Dec 07 '19 06:12 abhishek09091

The error itself comes from the daemon; https://github.com/docker/engine/blob/v19.03.5/daemon/container.go#L383-L405

And depending on if the daemon is running on Linux or Windows, this is the check that determines if the path is absolute;

https://github.com/docker/engine/blob/v19.03.5/pkg/system/filesys.go#L23

https://github.com/docker/engine/blob/v19.03.5/pkg/system/filesys_windows.go#L132

I see that "experimental" mode is enabled on the daemon and the microsoft/dotnet:sdk is multi-arch (i.e., there's both Linux and Windows variants of that image); with experimental mode enabled, it's possible that the Windows daemon runs a Linux container (using the experimental "LCOW" feature), which could potentially explain this error if it's attempting to run the Linux variant (on which C:\.... would not be a valid path?

thaJeztah avatar Dec 31 '19 11:12 thaJeztah

@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

noumaan786arshad avatar Mar 05 '20 22:03 noumaan786arshad

What should I do to resolve Absolute path Issue?

noumaan786arshad avatar Mar 05 '20 22:03 noumaan786arshad

Any update on this? I'm having the same issue as @noumaan786arshad, building a docker image in jenkins and then executing "sh npm script"

adelstrinidad avatar May 28 '20 01:05 adelstrinidad

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.

JorisDebonnet avatar May 31 '20 10:05 JorisDebonnet

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.

thaJeztah avatar Jun 04 '20 17:06 thaJeztah

Run it with PowerShell. Solved for me.

piccolorio avatar Jun 13 '20 16:06 piccolorio

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.

markp112 avatar Jul 08 '20 09:07 markp112

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

topsailcashew-zz avatar Aug 31 '20 05:08 topsailcashew-zz

@senjenathaniel see my comment above for the git bash case; https://github.com/docker/cli/issues/2204#issuecomment-638993192

thaJeztah avatar Aug 31 '20 12:08 thaJeztah

Run it with PowerShell. Solved for me.

@piccolorio , Mind explaining how you went about doing it that way?

Yorisoft avatar Jan 08 '21 19:01 Yorisoft

I solved it by removing the C: from the path, so the command should be something like:

docker run --rm -w /buildagenttemp/work/9d55fd57e39bb0f1 ...

IDrissAitHafid avatar Jan 26 '21 13:01 IDrissAitHafid

I am having that problem with jenkins now. Even using /c/agent-86 or //c/agent-86 for the agent's working directory gets:

agent-86 does not seem to be running inside a container $ docker run -d -t -w c:/agent-86/workspace/d1/ -v c:/agent-86/workspace/d1/:c:/agent-86/workspace/d1/ -v c:/agent-86/workspace/d1@tmp/:c:/agent-86/workspace/d1@tmp/ -e ******** -e ****

and

java.io.IOException: Failed to run image 'node:14-alpine'. Error: docker: Error response from daemon: the working directory 'c:/agent-86/workspace/d1/' is invalid, it needs to be an absolute path.

The source looks like it might be looking for a ':' if the os is unix and may be getting confused?

thanks

rtayek avatar May 21 '21 19:05 rtayek

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

lopshopedun avatar Sep 08 '21 17:09 lopshopedun

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!

Zvicii avatar Sep 15 '21 03:09 Zvicii

Am new to all this tools and programming, please help me in this while running my sample nodejs and react app in jenkins i get this error.

C:\WINDOWS\system32\config\systemprofile\AppData\Local\Jenkins\.jenkins\workspace\simple-node-js-react-npm-app>docker inspect -f . node:6-alpine 

.

Failed to run image 'node:6-alpine'. Error: docker: Error response from daemon: the working directory 'C:/WINDOWS/system32/config/systemprofile/AppData/Local/Jenkins/.jenkins/workspace/simple-node-js-react-npm-app/' is invalid, it needs to be an absolute path.

See 'docker run --help'.

Aravindyadhav avatar Sep 15 '21 07:09 Aravindyadhav

@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).

thaJeztah avatar Sep 15 '21 10:09 thaJeztah

I'm hitting the same issue with a slightly different command:

docker run --rm -it --env GOPATH=/go -v %CD%:/go/src -w /go/src quay.io/goswagger/swagger

Using GitBash terminal integrated into Visual Studio Code the error is

docker: Error response from daemon: the working directory 'C:/Program Files/Git/go/src' is invalid, it needs to be an absolute path.

I tried the PowerShell solution, but it fails due to %CD% with the error

docker: Error response from daemon: create %CD%: "%CD%" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.

Also tried googling for a solution but there was a thing called compact disk in prehistoric times that swarms the search results.

EDIT: Nevermind, it worked with CMD.

mathmul avatar Jan 30 '22 09:01 mathmul

curl : Cannot find drive. A drive with the name 'https' does not exist. At line:1 char:1

  • curl -s https://laravel.build/laraveldoker-app | bash
  •   + CategoryInfo          : ObjectNotFound: (https:String) [Invoke-WebRequest], DriveNotFoundException
      + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
    
    

not working what should i do

Afzal98-png avatar Aug 25 '22 10:08 Afzal98-png

@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).

thank you so much for consdering my question and i resolved the error somehow, thanks alot for your reply.

Aravindmuniraj avatar Aug 25 '22 11:08 Aravindmuniraj

@Aravindmuniraj do you have any idea what the problem was? I got the same error and stuck for a while :( Thanks for the help in advance

rajmunddongo avatar Sep 02 '22 11:09 rajmunddongo

@Radzsmi

please paste your reply here i will try to help if possible.

Aravindyadhav avatar Sep 02 '22 11:09 Aravindyadhav

@Radzsmi

please paste your reply here i will try to help if possible.

I somehow managed to do it, but I dont remember how. Thanks for the answer anyways. ( I remember that this thread did help)

rajmunddongo avatar Sep 20 '22 20:09 rajmunddongo

J'ai ce problème avec Jenkins maintenant. Même en utilisant /c/agent-86 ou //c/agent-86 pour le répertoire de travail de l'agent, on obtient :

agent-86 ne semble pas s'exécuter dans un conteneur $ docker run -d -t -wc:/agent-86/workspace/d1/ -vc:/agent-86/workspace/d1/:c:/agent-86 /workspace/d1/ -vc:/agent-86/workspace/d1@tmp/:c:/agent-86/workspace/d1@tmp/ -e ******** -e ****

et

java.io.IOException : Échec de l'exécution de l'image 'node:14-alpine'. Erreur : docker : réponse d'erreur du démon : le répertoire de travail 'c:/agent-86/workspace/d1/' n'est pas valide, il doit s'agir d'un chemin absolu.

La source semble rechercher un ':' si le système d'exploitation est unix et peut être confus?

Merci

Hello I encountered the same problem with jenkins, did you find the suitable solution?

Jenkins does not seem to be running inside a container $ docker run -d -t -w C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd/ -v C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd/:C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd/ -v C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd@tmp/:C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd@tmp/ -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** mcr.microsoft.com/playwright:v1.27.0-focal cmd.exe [Pipeline] // withDockerContainer [Pipeline] } [Pipeline] // withEnv [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.io.IOException: Failed to run image 'mcr.microsoft.com/playwright:v1.27.0-focal'. Error: docker: Error response from daemon: the working directory 'C:/ProgramData/Jenkins/.jenkins/workspace/Playwrigth-jenkins-ci-cd/' is invalid, it needs to be an absolute path. See 'docker run --help'.

JaimeDan12 avatar Oct 13 '22 14:10 JaimeDan12