Skip to content

Instantly share code, notes, and snippets.

@pavlo
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavlo/6f430affdaa6bc11f874 to your computer and use it in GitHub Desktop.
Save pavlo/6f430affdaa6bc11f874 to your computer and use it in GitHub Desktop.
Setup port forwarding for boo2docker so that you can access stuff runned in the VM
echo "STOPPING BOOT2DOCKER"
boot2docker stop
echo "APPLYING PORT FORWARDING RULES..."
for i in {8080..8100}; do
echo "Port: $i"
VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "tcp-port$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 delete "udp-port$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "tcp-port$i,tcp,,$i,,$i";
VBoxManage modifyvm "boot2docker-vm" --natpf1 "udp-port$i,udp,,$i,,$i";
done
echo "DONE. You can use boot2docker now - execute boot2docker up"
# boot2docker up
# docker run -p 8080:80 nginx
# open http://localhost:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment