Last active
August 29, 2015 14:01
-
-
Save YungSang/7b37b484d97af34557c6 to your computer and use it in GitHub Desktop.
Quickstart Docker example with google/busybox on boot2docker for Vagrant
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "yungsang/boot2docker" | |
config.vm.network "private_network", ip: "192.168.33.10" | |
config.vm.synced_folder ".", "/vagrant", type: "nfs" | |
# Fix busybox/udhcpc issue | |
config.vm.provision :shell do |s| | |
s.inline = <<-EOT | |
if ! grep -qs ^nameserver /etc/resolv.conf; then | |
sudo /sbin/udhcpc | |
fi | |
cat /etc/resolv.conf | |
EOT | |
end | |
# Adjust datetime after suspend and resume | |
config.vm.provision :shell do |s| | |
s.inline = <<-EOT | |
sudo /usr/local/bin/ntpclient -s -h pool.ntp.org | |
date | |
EOT | |
end | |
config.vm.provision :docker do |d| | |
d.pull_images "yungsang/busybox" | |
d.run "simple-echo", | |
image: "yungsang/busybox", | |
args: "-p 8080:8080", | |
cmd: "nc -p 8080 -l -l -e echo hello world!" | |
end | |
config.vm.network :forwarded_port, guest: 8080, host: 8080 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Containers on Google Cloud Platform - Google Compute Engine — Google Developers
https://developers.google.com/compute/docs/containers#quickstart_example