Skip to content

Instantly share code, notes, and snippets.

@kballenegger
Created May 9, 2014 19:19
Show Gist options
  • Select an option

  • Save kballenegger/9e4dbb77a50b93702608 to your computer and use it in GitHub Desktop.

Select an option

Save kballenegger/9e4dbb77a50b93702608 to your computer and use it in GitHub Desktop.
Vagrant+Docker networking problems.
# The two above specifies which version of the vagrant API is used.
Vagrant.configure('2') do |config|
# This is a hack around the networking slowness in the VM.
config.vm.provider 'virtualbox' do |vb|
vb.customize ['modifyvm', :id, '--natdnshostresolver1', 'on']
vb.customize ['modifyvm', :id, '--natdnsproxy1', 'on']
vb.customize ['modifyvm', :id, '--natpf1', 'app,tcp,,9977,,9977']
end
# TODO: move to using Quay
config.vm.synced_folder '../docker', '/docker'
config.vm.synced_folder '.', '/app'
# Forward port 80 to dev port 9977
#config.vm.network 'forwarded_port', guest: 9977, host: 9977, auto_correct: true
config.vm.network :private_network, ip: "192.168.50.4"
# This is the main app container
config.vm.define 'app' do |app|
# Each docker container here gets a `provider` block.
app.vm.provider 'docker' do |d|
d.build_dir = '../docker/rack-app'
d.ports = ['9977:80']
d.volumes = ['/app']
d.cmd = ['bash', '-l', '-c', 'echo "Launching server." && bundle install; ' +
'bundle exec thin -R config.ru -p 80 start']
end
end
# This is just a dummy container we can use to interact with the box above.
config.vm.define 'test' do |app|
app.vm.provider 'docker' do |d|
d.image = 'ubuntu'
d.create_args = %w(--link api-internal_app_1399599910:app)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment