Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # This script uses Virtualbox Port Forwarding to make all Docker services
- # available on Windows host under `localhost`
- VBXMGMT=/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe
- # List all the running container ids
- docker ps -q | while read -r i; do
- # List all the ports bound by this container<Paste>
- for port in $(docker port "$i" | cut -d'-' -f1); do
- port_num=$(echo "${port}" | cut -d'/' -f1)
- port_type=$(echo "${port}" | cut -d'/' -f2)
- echo "Create rule natpf1 for ${port_type} port ${port_num}"
- "$VBXMGMT" controlvm "default" natpf1 "${port_type}-port${port_num},${port_type},,${port_num},,${port_num}"
- done
- done
Add Comment
Please, Sign In to add comment