tmatilai / vagrant-proxyconf

Vagrant plugin that configures the virtual machine to use proxies
MIT License
531 stars 74 forks source link

Run configuration for docker after provisioning #99

Closed otahi closed 9 years ago

otahi commented 9 years ago

I have changed to run configuration for docker after provisioning to solve #98.

I have tested with this.

Vagrantfile

# -*- mode: ruby -*-
VAGRANTFILE_API_VERSION = '2'

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  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.enabled  = true
  end

  config.vm.synced_folder './', '/vagrant', disabled: true

  config.vm.define 'centos7' do |c|
    c.vm.box = 'hfm4/centos7'
    c.vm.provision "docker"
  end
end

Log

[otahi@otahiair vagrant-proxyconf-test]$ vagrant up centos7
Bringing machine 'centos7' up with 'virtualbox' provider...
==> centos7: Importing base box 'hfm4/centos7'...
:
:
==> centos7: Machine booted and ready!
==> centos7: Configuring proxy environment variables...
==> centos7: Configuring proxy for Yum...
:
:
==> centos7: Running provisioner: docker...
    centos7: Installing Docker (latest) onto machine...
    centos7: Configuring Docker to autostart containers...
==> centos7: Configuring proxy for Docker...
[otahi@otahiair vagrant-proxyconf-test]$

Test

[otahi@otahiair vagrant-proxyconf-test]$ vagrant ssh centos7 -c 'sudo cat /proc/`pgrep docker|head -n1`/environ'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/binLANG=en_US.UTF-8NOTIFY_SOCKET=@/org/freedesktop/systemd1/notifyLISTEN_PID=5635LISTEN_FDS=1OPTIONS=--selinux-enabled -H fd://HTTP_PROXY=http://10.0.2.2:3128/NO_PROXY=http_proxy=http://10.0.2.2:3128/no_proxy=DOCKER_STORAGE_OPTIONS=Connection to 127.0.0.1 closed.
[otahi@otahiair vagrant-proxyconf-test]$
otahi commented 9 years ago

Hi @dkoper, Can you check this pull request?

dkoper commented 9 years ago

Oh with just a one-line fix, how sweet!

I've applied the change to my environment and it's working well. Great job!

On my Ubuntu box I've also confirmed /etc/default/docker was set correctly and that I can pull in a docker image without needing to restart the docker service. All is well.

otahi commented 9 years ago

Thank you for checking! We have confirmed it works.

otahi commented 9 years ago

@tmatilai Do you have a plan for the next release? I want to use this version if possible.

tmatilai commented 9 years ago

@otahi I think we're ready for a release. Need to update the changelog and test a bit. I'll try to get it done soon.