Docker Community Forums

Share and learn in the Docker community.

Windows Containerized Development with Volumes

docker

#1

I recently started to learn Docker and I have ran into some problems initializing a volume for automatic file updating for my created directory.

To be more specific I am currently working on the tutorial Please Contain Yourself /level 4 / from github

I am currently running Windows 10 home so I am running docker toolbox. As the tutorial says when trying to run the command

docker run -d -p 8080:8080 -v ${PWD}:/src/app [container name]

I am met with difficulties on the volume running.

If anyone has done this tutorial with a windows can I get some help on how to work these volume creation on a windows.

Thanks.


(Tekki) #2

You don’t tell us what your problem is, but in PowerShell write "$(pwd):/src/app" (with double quotes). Open the settings of Docker Desktop and make sure that your drive is activated as a shared drive. If it still doesn’t work check if your firewall blocks the Docker network.


#3

Hey thanks for responding. I can’t change any shared drives due to me having to use docker toolbox due to my computer not being a Pro or an Enterprise.

I have tried to run it, but like every other time it doesn’t seem to amount to anything.


I have also tried

${PWD}

“${PWD}”

//d/program_files/…/with_volumes.:/src/app

When running it the way that they provided It seems to mount, but exits running immediately.

$ pwd
/Please-Contain-Yourself/4-Containerized_Development_With_Volumes

$ docker run -d -p 8080:8080 -v /Please-Contain-Yourself/4-Containerized_Development_With_Volumes:/src/app --name cola

cf16c7156fc8 colorserver “npm run startdev” 22 seconds ago Exited (254) 18 seconds ago cola

again thanks for responding I’ve been stuck on this for a couple hours.


(Tekki) #4

docker run -d -p 8080:8080 -v “$(pwd):/src/app” --name color colorserver

You forgot the -v.
And you are on drive D:. By default only drive C: is available (for both Docker Desktop and Docker Toolbox). To get access to D: follow these instructions.


#5

Oh woops I guess I’m getting tired, but somehow it gives me another error

PS D:\Program Files\Git\Please-Contain-Yourself\4-Containerized_Development_With_Volumes> docker run -d -p 8080:8080 -v “$(pwd):/src/app” --name color colorserver

D:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mode: /src/app.

think this is based off of my docker file so my docker file includes:

FROM node:7.6-alpine

RUN mkdir -p /src/app

WORKDIR /src/app

COPY . /src/app

RUN yarn install

RUN yarn global add nodemon

EXPOSE 8080

CMD [ "npm", "run", "startdev" ]

(Tekki) #6

A new error is already a progress, isn’t it? :wink:
My answer is probably not sufficient for Docker Toolbox. Seems drive D: not mounted correctly (did you add drive D: itself to Virtualbox or something else?). I recommend that you isolate this problem and for example try

docker run --rm -v “$(pwd):/src/app” alpine ls /src/app

until your local files from Windows are listed.


#7

Oh I’ve ran into that error before so I am still quite stuck.

Here is also my shared folder settings. I have changed the C: to D: drive before this troubleshooting.

But yea thanks for the help i’ll keep trying different things