Skip to content

Instantly share code, notes, and snippets.

@misraX
Last active August 11, 2017 12:10
Show Gist options
  • Save misraX/815576df882736b1886f2410c9d92867 to your computer and use it in GitHub Desktop.
Save misraX/815576df882736b1886f2410c9d92867 to your computer and use it in GitHub Desktop.
Exposing Docker ports to host machine using iptables.
#!/bin/bash
ip=172.17.0.2
port=8080
iptables -t nat -A DOCKER -p tcp --dport $(port) -j DNAT --to-destination $(ip):$(port)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment