Bind mounts - docker run command in Getting Started tutorial not working

I’m working on both Linux and Windows 10. Just a note to say if you’re on Windows and not having any joy in presenting the /app dir in Docker Desktop then check you’re not using a network share or have restrictive rights on your path. PowerShell and Windows like to throw things like extra security into the mix sometimes.

Just want to point out I’m using windows as I’ve got a few ports in use on my Linux box so must point out I feel saddened by @ mgabeldocker dismissing Windows as a viable place to learn Docker…

Solved after two days of persistence:

This doesn’t work in bash on visual studio, I switched back to powershell (as I type I realize this is actually what’s being described in the tutorial, sort of, but is confusing because the persistent use of “$”).

In powershell run “pwd”, and substitute that response for the entire “$(pwd)” so the result has no quotations.

Your result should look similar to this, with your own working directory:

docker run -dp 3000:3000 `
    -w /app --mount type=bind,src=C:\user\tutorials\docker\getting-started\app,target=/app `
    node:18-alpine `
    sh -c "yarn install && yarn run dev"

The commas are pauses so the command is broken into steps, I think they’re important syntax here.

I wasted far too much time reading the errors and working them individually, but in the end it seemed that the errors were all pointing me the right direction from the start. My suggestion is to go back through this step and review the errors, so they are familiar going forward. It’s a very simple fix that should take less than two minutes in the future once it’s familiar.

Anyway, the next command worked fine and I was able to watch the logs. Figured I would share here because I landed on this page trying to find a solution myself.