Search code examples
dockerdirectorypathdocumentation

Docker Tutorial Unclear: "Persisting our DB" and "Using Bind Mounts"


I have only started using Docker and was trying to follow the documentation on the official website... Everything was going smoothly until I got to this point. In step 3: step 3 of docker tutorial - Persisting our DB Upon running the command, I get this error -> ls: cannot access 'C:/Program Files/Git/': No such file or directory.

I thought it was not that big of a deal so I went ahead and skipped to the following parts of the tutorial. Then I came across the same error in this part: step 2 and 3 Docker Tutorial - Using bind Mounts

I tried to locate the directory on my PC manually and found a remote git repository, but the commands still don't work for me. These were the commands that I have tried and their corresponding errors:

docker run -it ubuntu ls / - No such file or directory

cd /path/to/getting-started/app - No such file or directory

docker run -dp 3000:3000 ` -w /app -v "$(pwd):/app" ` node:12-alpine ` sh -c "yarn install && yarn run dev" - docker: Error response from daemon: the working directory 'C:/Program Files/Git/app' is invalid, it needs to be an absolute path. See 'docker run --help'. (this error was after changing to the directory I manually searched on my PC)

I'm unsure if I have to set a PATH??? I don't think I have missed any of the steps provided in the earlier tutorials.


Solution

  • Thanks, guys! I was indeed using git bash on VSCode. I tried running it on my Windows terminal via ubuntu and now, everything's working fine. Thanks, Max, and Spears. Exactly what I was having issues with.

    These comments helped me resolve the issue:

    Maybe this is your problem github.com/docker-archive/toolbox/issues/673 – Max

    Sounds like you are using the git bash which comes packages with git scm for >windows. I strongly recommend to avoid this and switch to WSL2. The git bash >is NOT the kind of shell you are looking for when using docker due to missing >libs and nasty side effects which are mostly very hard to debug. - Spears