Broken volume bind path for docker on windows
- Dominant language
- Ruby
- Stars
- 27.2k
- Forks
- 4.4k
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
### Vagrant version
2.2.9
### Host operating system
Windows 10 Pro 19041.264
### Guest operating system
tknerr/baseimage-ubuntu-18.04
### Docker version
Docker version 19.03.8, build afacb8b
The issue occurs with enabled WSL2 support in docker as well as without
### Vagrantfile
```ruby
Vagrant.configure("2") do |config|
config.vm.box = 'bento/ubuntu-18.04'
config.vm.box_version = "201812.27.0"
config.vm.synced_folder "./", "/vagrant", :owner => "www-data", :mount_options => ["dmode=6775,fmode=6664"]
config.vm.provider "docker" do |d, override|
override.vm.box = "tknerr/baseimage-ubuntu-18.04"
override.vm.box_version = nil
end
config.vm.provision :shell do |sh|
sh.path = "provisioning/bootstrap.sh"
sh.args = "./ansible /vagrant/provisioning/site.yml /vagrant/provisioning/ansible_hosts npm_opts=--no-bin-links"
end
end
```
### Debug output
https://gist.github.com/BGehrels/3b95e5483f6587948e0d869c7bbc3074
### Expected behavior
Box comes up and runs ansible
### Actual behavior
Box comes up, but with an empty `/vagrant` folder. therefore provisioning fails
### Steps to reproduce
1. dir ./provisioning (folder is not empty)
1. vagrant up
2. vagrant ssh
3. cd /vagrant
4. ls (folder is empty)
### Analysis
Looking in the logs, i can see that vagrant executes
```
"C:\\Program Files\\Docker\\Docker\\resources\\bin/docker.EXE", "run", "--name", "myproject_default_1589375001", "-d", "-p", "127.0.0.1:2222:22", "-v", "//c/Users/Firstname Last/PhpStormProjects/myproject:/vagrant", "tknerr/baseimage-ubuntu:18.04"
```
When i execute this command myself, a docker container is started and when I execute `ls /vagrant` inside that docker container, the directory is empty as well.
But: When i change the volume path from unix to windows style as follows:
```
"C:\\Program Files\\Docker\\Docker\\resources\\bin/docker.EXE", "run", "--name", "myproject_default_1589375001", "-d", "-p", "127.0.0.1:2222:22", "-v", "C:\Users\Firstname Last\PhpStormProjects\myproject:/vagrant", "tknerr/baseimage-ubuntu:18.04"
```
the docker container starts and the contents of the directory show up.
I would therefore expect the error to be related to the way vagrant builds the docker run command and therefore probably on vagrants side
Contributor guide
Research direction
Start by reproducing the Docker provider run command from the issue and compare the Unix-style and Windows-style volume paths. Trace the Vagrant Docker provider code that builds the volume argument, then verify that the Windows path mounts the project contents at /vagrant and allows provisioning to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, ruby
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100