Closed NikolayPianikov closed 1 year ago
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
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 : 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
RUN apt-get update && \apt-get install -y maven && \apt-get clean
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
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
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
What should I do to resolve Absolute path Issue?
Any update on this? I'm having the same issue as @noumaan786arshad, building a docker image in jenkins and then executing "sh npm script"
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.
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 theMSYS_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.
Run it with PowerShell. Solved for me.
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.
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
@senjenathaniel see my comment above for the git bash case; https://github.com/docker/cli/issues/2204#issuecomment-638993192
Run it with PowerShell. Solved for me.
@piccolorio , Mind explaining how you went about doing it that way?
I solved it by removing the C:
from the path, so the command should be something like:
docker run --rm -w /buildagenttemp/work/9d55fd57e39bb0f1 ...
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
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
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!
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 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).
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.
curl : Cannot find drive. A drive with the name 'https' does not exist. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (https:String) [Invoke-WebRequest], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
not working what should i do
@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 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
@Radzsmi
please paste your reply here i will try to help if possible.
@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)
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'.
This is the end of 2022 and I experienced the same error. If anyone has the same error using bash command line on windows, you may like to use powershell with admin rights.
It worked for me when I used Windows Command Prompt.
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
@Angell4S looks like you ran into mingw automatic path conversion, which was mentioned further up in this ticket https://github.com/docker/cli/issues/2204#issuecomment-638993192
Looking at this ticket, I don't think there's anything actionable / anything to fix here, and many comments are related to the automatic path conversion mentioned, which is not an issue with docker itself.
I'm closing this ticket
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:
Run
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
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Host:
Related issue: https://youtrack.jetbrains.com/issue/TW-62945