Skip to content

Instantly share code, notes, and snippets.

@av-ast
Created May 26, 2015 08:49
Show Gist options
  • Save av-ast/3b1b4d4fdc7011f30215 to your computer and use it in GitHub Desktop.
Save av-ast/3b1b4d4fdc7011f30215 to your computer and use it in GitHub Desktop.
Forward VM ports to localhost
#!/bin/bash
if [ "$#" -eq 0 ]; then
echo "USAGE: ./forward_ports.sh 1234 5678"
exit 1
fi
for port; do
echo "Forwarded port $port"
VBoxManage controlvm boot2docker-vm natpf1 "tcp-port$port,tcp,127.0.0.1,$port,,$port"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment