[Lxc-users] Redirect localhost requests to a Linux container

Shibashish shib4u at gmail.com
Wed Jul 31 09:15:41 UTC 2013


Are you sure your service is listening on localhost:<port> ?

I'd use "netstat" to verify that first.

ShiB.
while ( ! ( succeed = try() ) );


On Wed, Jul 31, 2013 at 2:31 PM, Robin Monjo <robin.monjo at applidget.com>wrote:

> Hello, I'm struggling with port forwarding for requests coming from
> localhost.
>
>  I run some linux container on my ubuntu host. Each one of them are
> running a webapp. To be able to access these webapps, I use iptables to
> forward port:
>
> sudo iptables -t nat -A PREROUTING -p tcp --dport <port> -j DNAT --to-destination #<container_ip>:<port>
>
> This work well if the traffic comes from outside of my machine. If the
> request is done by localhost it doesn't work:
>   curl <host_ip>:<port> #works (from outside the host)
>
>  curl <container_ip>:<port>  #works (from inside the host)
>  curl 127.0.0.1:<port>       #doesn't work (from inside the host)
>
>
> Any clue how to be able to make this last curl command working ?
>
> Regards,
> Robin
>
>
> ------------------------------------------------------------------------------
> Get your SQL database under version control now!
> Version control is standard for application code, but databases havent
> caught up. So what steps can you take to put your SQL databases under
> version control? Why should you start doing it? Read more to find out.
> http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130731/a32d4c4e/attachment.html>


More information about the lxc-users mailing list