-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get volumes to work with docker-compose in windows #3073
Comments
If you're trying to use a named volume, you must declare it in the If you're trying to use a host volume, the equivalent with the docker cli is Also note that if you're toolbox, only your home directory and subdirectories are shared with the vm, so the host volume must be under your home directory. |
Thanks for the response. I am trying to setup a host volume, not a named volume.
This must not be true on windows because the physical path of my code is C:\projects\new_project. ui is a folder under new_project. When I use
I am able to see my code in the container |
Does this mean with docker compose my source has to be under my user directory? Because when I use
I am able to see my code in the container and it is not under my user directory. If they are different, then that could be throwing me off. |
I tried moving my project files into C:\Users\rmclaughlin\projects\powerdialer-ui and I set my volume like this
I also tried this
but both failed. |
alright, I got it to work. I not only had to move my project under the user directory, but I had to run it from that location also. Now relative paths also work, like this
|
As this is currently the first google result for "but no declaration was found in the volumes section", here is a bit more information. In case you actually like to mount an already existing docker volume (not a host directory) using docker-compose, you are dealing with what docker-compose calls an "external volume", which you have to specify in the docker-compose. yml in the following way. So again, let's assume there is already a docker volume with name ui-volume, then this would have to read:
|
With Bash on Windows, if it can help, I got it to work with this:
|
@justechn could you describe what you mean by "running it in that location?" I am encountering the same problem as yourself, tried the relative path, having the project under my user files, running with:
|
I had to run docker from the project directory instead of giving docker the project path. Instead of this:
I did
|
And you aren't getting the error message when doing |
I'm having the same. I have tried to set the volumes to: I have also tried adding a .env folder with: When I do docker-compose up I see everything from: ERROR: for angular-seed Cannot create container for service angular-seed: invalid bind mount spec "C:\Users\k\dev\angular-seed\dev\angular-seed:/home/app/angular-seed:rw": invalid volume specification: 'C:\Users\k\dev\angular-seed\dev\angular-seed:/home/app/angular-seed:rw' ERROR: for angular-seed Cannot create container for service angular-seed: create \c\Users\k\dev\angular-seed: "\c\Users\k\dev\angular-seed" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intented to pass a host directory, use absolute path |
@krissm where you able to resolve your issue here? |
In my case (I was trying to compose from pyCharm) adding .env didn't helped. |
@krissm I believe the |
I am trying to setup a docker-compose but no matter what I do, I cannot get the volumes to work.
Here is what my docker-compose.yml
I have tried several different configurations of volume, but none have worked so far.
If I run my image like this then the volume is mounted correctly
If I change the docker-compose.yml volume to look like this
I get an error "Named volume "ui:/src:rw" is used in service "ui" but no declaration was found in the volumes section."
I am using Docker version 1.10.1, build 9e83765 on Windows 7
The text was updated successfully, but these errors were encountered: