Last active
August 29, 2015 14:23
-
-
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
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
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