Guest User

Untitled

a guest
Nov 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # This script uses Virtualbox Port Forwarding to make all Docker services
  4. # available on Windows host under `localhost`
  5.  
  6. VBXMGMT=/c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe
  7.  
  8. # List all the running container ids
  9. docker ps -q | while read -r i; do
  10. # List all the ports bound by this container<Paste>
  11. for port in $(docker port "$i" | cut -d'-' -f1); do
  12. port_num=$(echo "${port}" | cut -d'/' -f1)
  13. port_type=$(echo "${port}" | cut -d'/' -f2)
  14. echo "Create rule natpf1 for ${port_type} port ${port_num}"
  15. "$VBXMGMT" controlvm "default" natpf1 "${port_type}-port${port_num},${port_type},,${port_num},,${port_num}"
  16. done
  17. done
Add Comment
Please, Sign In to add comment