{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/8608","repository_url":"https://api.github.com/repos/mitchellh/vagrant","labels_url":"https://api.github.com/repos/mitchellh/vagrant/issues/8608/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/vagrant/issues/8608/comments","events_url":"https://api.github.com/repos/mitchellh/vagrant/issues/8608/events","html_url":"https://github.com/mitchellh/vagrant/issues/8608","id":230414786,"number":8608,"title":"Docker provider tries to map volumes with host machine path format instead of the host_vm's","user":{"login":"agusti-t","id":19553064,"avatar_url":"https://avatars0.githubusercontent.com/u/19553064?v=3","gravatar_id":"","url":"https://api.github.com/users/agusti-t","html_url":"https://github.com/agusti-t","followers_url":"https://api.github.com/users/agusti-t/followers","following_url":"https://api.github.com/users/agusti-t/following{/other_user}","gists_url":"https://api.github.com/users/agusti-t/gists{/gist_id}","starred_url":"https://api.github.com/users/agusti-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agusti-t/subscriptions","organizations_url":"https://api.github.com/users/agusti-t/orgs","repos_url":"https://api.github.com/users/agusti-t/repos","events_url":"https://api.github.com/users/agusti-t/events{/privacy}","received_events_url":"https://api.github.com/users/agusti-t/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-05-22T14:30:36Z","updated_at":"2017-07-04T11:43:47Z","closed_at":null,"body":"### Vagrant version\r\n1.9.5\r\n\r\n### Host operating system\r\nWindows 10\r\n\r\n### Guest operating system\r\nubuntu/trusty64\r\n\r\n### Vagrantfile (host)\r\n```ruby\r\n# -*- mode: ruby -*-\r\n# vi: set ft=ruby :\r\n\r\n# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!\r\nVAGRANTFILE_API_VERSION = \"2\"\r\n\r\nVagrant.configure(VAGRANTFILE_API_VERSION) do |config|\r\n\tconfig.vm.boot_timeout = 120\r\n\tconfig.vm.box = \"ubuntu/trusty64\"\r\n\tconfig.vm.hostname = \"docker-provider-host\"\r\n\tconfig.vm.provider :virtualbox do |vb|\r\n\t\tvb.name = \"docker-provider-host\"\r\n\t\tvb.customize [\r\n                \"modifyvm\", :id,\r\n                \"--memory\", 8192,\r\n\t\t]\r\n\tend\r\n\t\r\n\tconfig.vm.network \"private_network\", ip: \"192.168.33.60\"\r\n\t\r\n\tconfig.ssh.username = \"vagrant\"\r\n        config.ssh.password = \"vagrant\"\r\n        config.ssh.insert_key = true\r\n\t\r\n\t# Disable sync of current folders\r\n\tconfig.vm.synced_folder \".\", \"/home/vagrant/sync\", disabled: true\r\n\r\n        $logs_folders = <<-LOGS_FOLDERS\r\n\t\tmkdir -p /var/log/my-application\r\n\tLOGS_FOLDERS\r\n\tconfig.vm.provision \"logs_folders\", type: \"shell\", inline: $logs_folders\r\n\t\r\n\t# Make it possible for the volumes mounted into the container to be written to\r\n\t# \tref: https://goldmann.pl/blog/2014/07/18/logging-with-the-wildfly-docker-image/\r\n\t# Observe that since the above post the base docker image for Wildfly has changed\r\n\t# and now they use uid/gid 1000/1000 so first regular user, i.e. in a vagrant box\r\n\t# it is the vagrant user.\r\n\t# \tref: https://github.com/jboss-dockerfiles/base/blob/master/Dockerfile\r\n\t$logs_folders_permissions = <<-LOGS_FOLDERS_PERMISSIONS\r\n\t\tchown -R vagrant:vagrant /var/log/my-application\r\n\tLOGS_FOLDERS_PERMISSIONS\r\n\tconfig.vm.provision \"logs_folders_permissions\", type: \"shell\", privileged: true, inline: $logs_folders_permissions\r\n\r\n\t# Install docker\r\n\tconfig.vm.provision \"docker\"\r\n\t\r\n\t# Add user vagrant to docker group\r\n\t$docker_group = <<-DOCKER_GROUP\r\n\t\tusermod -a -G docker vagrant\r\n\t\trestart docker\r\n\t\tnewgrp docker\r\n\tDOCKER_GROUP\r\n\tconfig.vm.provision \"docker_group\", type: \"shell\", privileged: true, inline: $docker_group\r\nend\r\n```\r\n\r\n### Vagrantfile (docker-provider)\r\n```ruby\r\nVagrant.configure(\"2\") do |config|\r\n  config.vm.provider \"docker\" do |docker|\r\n\t# Some inspiration: http://theunic.github.io/2014/12/29/development-environments-with-vagrant-and-docker.html\r\n\t\r\n\tconfig.vm.synced_folder \".\", \"/vagrant\", disabled: true\r\n\t\r\n\tdocker.build_dir = \".\"\r\n\tdocker.dockerfile = \"Dockerfile.dev\"\r\n\tdocker.host_vm_build_dir_options = {\r\n        type: \"rsync\"\r\n    }\r\n\tdocker.remains_running = true\r\n\tdocker.vagrant_vagrantfile = \"../Vagrantfile\"\r\n\tdocker.force_host_vm = true\r\n\t\r\n\tdocker.create_args = [\"-d\", \"-it\", \"-m\", \"2g\"]\r\n\tdocker.ports = [\r\n\t\t\"9082:8080\",\r\n\t\t\"9992:9990\",\r\n\t\t\"8788:8787\"\r\n\t]\r\n\tdocker.name = \"my-application-test\"\r\n\tdocker.env = {\r\n\t\t\"JAVA_OPTS\":\"-Xms512m -Xmx1536m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n\"\r\n\t}\r\n\tdocker.volumes = [\r\n\t\t\"/var/log/my-application:/opt/jboss/wildfly/standalone/log\"\r\n\t]\r\n\tdocker.cmd = [\r\n\t\t\"/opt/jboss/wildfly/bin/standalone.sh\",\r\n\t\t\"-Dtarget.mode=test\",\r\n\t\t\"-Ddev=true\",\r\n\t\t\"-Djava.net.preferIPv4Stack=true\",\r\n\t\t\"-Djava.net.preferIPv4Addresses\",\r\n\t\t\"-b\", \"0.0.0.0\",\r\n\t\t\"-bmanagement\", \"0.0.0.0\"\r\n\t]\r\n  end\r\nend\r\n```\r\n\r\n#Dockerfile\r\n```\r\nFROM jboss/wildfly:10.1.0.Final\r\n```\r\n\r\n### Debug output\r\nNo debug yet, will provide upon request.\r\n\r\n### Expected behavior\r\nWorked in 1.9.4. Create docker image and container.\r\n\r\n### Actual behavior\r\nIt appears the volumes parameter for docker provider tries to synch using the path formatting of the host machine instead of the host_vm created to build and run the docker containers from.\r\n\r\nI get the following.\r\n```\r\nA Docker command executed by Vagrant didn't complete successfully!\r\nThe command run along with the output from the command is shown\r\nbelow.\r\n\r\nCommand: \"docker\" \"run\" \"--name\" \"my-application-test\" \"-d\" \"-e\" \"JAVA_OPTS=-Xms512m -Xmx1536m -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n\" \"-p\" \"9083:8080\" \"-p\" \"9993:9990\" \"-p\" \"8789:8787\" \"-v\" \"C:\\cygwin64\\var\\log\\my-application:/opt/jboss/wildfly/standalone/log\" \"-v\" \"-d\" \"-it\" \"-m\" \"2g\" \"43561cedfe70\" \"/opt/jboss/wildfly/bin/standalone.sh\"  \"-Dtarget.mode=test\" \"-Ddev=true\" \" \"-Djava.net.preferIPv4Stack=true\" \"-Djava.net.preferIPv4Addresses\" \"-b\" \"0.0.0.0\" \"-bmanagement\" \"0.0.0.0\"\r\n\r\nStderr: docker: Error response from daemon: invalid bind mount spec \"C:\\\\cygwin64\\\\var\\\\log\\\\my-application:/opt/jboss/wildfly/standalone/log\": invalid mode: /opt/jboss/wildfly/standalone/log.\r\nSee 'docker run --help'.\r\n\r\nStdout:\r\n    default: The previous process exited with exit code 1.\r\n```\r\nObserve this specifically:  \"-v\" \"C:\\cygwin64\\var\\log\\my-application:/opt/jboss/wildfly/standalone/log\"\r\n\r\n### Steps to reproduce\r\n1. create a folder, copy the host Vagrantfile.\r\n2. create a folder/subFolder, copy the docker Vagrantfile.\r\n3. create a folder/subFolder/Dockerfile.dev with the content above.\r\n4. run vagrant up from folder/subFolder\r\n\r\n### References\r\nNone that I know about. I know there where some changes regarding force_host_vm flag in 1.9.4 but they worked. I don't know what other changes have been done to Docker provider for 1.9.5. I think @chrisroberts is very well informed.\r\n\r\nUPDATE: Could this be caused by https://github.com/mitchellh/vagrant/commit/5d83c03bfc48407451999f21b0320a1ebb22a8cd?\r\n"},"comment":{"url":"https://api.github.com/repos/mitchellh/vagrant/issues/comments/312857013","html_url":"https://github.com/mitchellh/vagrant/issues/8608#issuecomment-312857013","issue_url":"https://api.github.com/repos/mitchellh/vagrant/issues/8608","id":312857013,"user":{"login":"l00tr","id":13413150,"avatar_url":"https://avatars0.githubusercontent.com/u/13413150?v=3","gravatar_id":"","url":"https://api.github.com/users/l00tr","html_url":"https://github.com/l00tr","followers_url":"https://api.github.com/users/l00tr/followers","following_url":"https://api.github.com/users/l00tr/following{/other_user}","gists_url":"https://api.github.com/users/l00tr/gists{/gist_id}","starred_url":"https://api.github.com/users/l00tr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l00tr/subscriptions","organizations_url":"https://api.github.com/users/l00tr/orgs","repos_url":"https://api.github.com/users/l00tr/repos","events_url":"https://api.github.com/users/l00tr/events{/privacy}","received_events_url":"https://api.github.com/users/l00tr/received_events","type":"User","site_admin":false},"created_at":"2017-07-04T11:43:47Z","updated_at":"2017-07-04T11:43:47Z","body":"I can confirm the issue for an almost identical setup, removing the error causing patch as suggested by @agusti-t as workaround fixes the issue for now."}}
{"actor":{"display_login":"l00tr"}}