How to Forward PORT to LXC container [quick tip ]

Quick Guide about how to forward port to lxc container using iptables , very quickly without using network bridging etc .
see how to setup LXC container .

Screen Shot 2014-03-13 at 11.18.17 pm


sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to [DestinationIP:PORT]

I use that to forward port 80 to LXC container running Nginx . and now every request for 80 will be redirected to LXC container and nginx will serve the requested page .
If you are looking for some other resource some awesome projects are ..

  1. dokku
  2. docker
  3. flynn
Tagged With : -