Closed mabako closed 5 years ago
config.vm.provision "shell", privileged: false,
inline: "/bin/bash /home/ubuntu/baseImageProvisioner.sh"
The same problem. baseImageProvisioner.sh
has a Docker installation script and Docker pull script, but that pull scripts didn't work despite the successful installation of Docker.
To avoid this problem, I have pick docker installation script out, and execute it first. like this:
config.vm.provision "shell", privileged: false,
inline: "curl -fsSL https://get.docker.com/ | sh"
config.vm.provision "shell", privileged: false,
inline: "/bin/bash /home/ubuntu/baseImageProvisioner.sh"
Can confirm, additionally I have found that calling vagrant provision
after the initial vagrant up
has failed also sets the proxy. I can also confirm that the workaround of having two provision blocks works.
My Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.disksize.size = "20GB"
config.vm.network "private_network", ip: "192.168.50.4"
config.vm.provider "virtualbox" do |v|
v.name = "Ubuntu_docker_poc"
v.memory = 2048
v.customize ["modifyvm", :id, "--uartmode1", "disconnected"] # see https://bugs.launchpad.net/cloud-images/+bug/1627844
end
if Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://10.0.2.2:3128"
config.proxy.https = "http://10.0.2.2:3128"
config.proxy.no_proxy = "localhost,127.0.0.1"
end
#set up keyboard layout (de)
config.vm.provision "shell", inline: "sed -ie '/^XKBLAYOUT=/s/\".*\"/\"de\"/' /etc/default/keyboard && udevadm trigger --subsystem-match=input --action=change"
config.vm.provision "docker" do |d|
d.build_image "/vagrant/docker"
end
end
Ugh, yeah, I've started to see other's report this problem as well. There is no easy fix to this problem that I can see due to the way Vagrant uses the Middleware stack to provision a guest. I've seen lots of weird oddities around using the docker provisioner in the Vagrantfile and it all seems to be related to the middleware stack.
Here's a couple of issues that may be similar due to the Middleware in vagrant.
As a workaround, the proposed solution is the only solution that I've come up with which instead of using config.vm.provision "docker"
to instead install docker via shell script.
I'd also recommend upgrading to 2.0.x
as there are many new bug fixes.
This is a rather old issue and we have not received any further communication about it in a while. I'd recommend upgrading this plugin to the latest release. I hope to have 2.0.1 out very soon which I hope addresses this issue.
Please also see #189 where I've attempted to address docker related issues with this plugin.
Please open a new issue or re-open this issue if it's still broken after the 2.0.1 release is out.
Hey,
I've been trying to get the docker provisioner inside vagrant to work with vagrant-proxyconf, however the proxy conf seems to be set effectively only the second time the provisioner is used.
I've configured the proxy settings in my ~/.vagrant.d/Vagrantfile; and here's just the files I used to test:
Vagrantfile that won't work:
Vagrantfile that works:
Version
Log