Localhost is not a valid ip address

networking

#1

I have set up a container with Tomcat8 and nginx to serve up website access for my home lab. When I try to pass the host system’s network connection through to the container I receive an error message about localhost not being a valid ip address. I use lxc config device add ... listen=tcp ... connect=tcp:localhost:443 to pass the connection through. I’ve used it with success in the past, including the weekend of May 11-12.

This occurred when the host had (vanilla) Ubuntu 18.04 installed, and when it had Ubuntu 18.10. LXD was installed using snap.

I would appreciate help with sorting this matter out.

~ML


(Thomas Parrott) #2

@eunosm3 are you using the proxy device?

If so then you need to specify only numeric IP addresses, rather than “localhost”.

So try tcp:127.0.0.1:443 instead

Thanks
Tom


#3

Have a look at

If you have existing containers that mention localhost, then also see the workaround in the post.


#4

Tom,

Thanks for the response. Using localhost had worked previously, but I did try using the numeric IP already. It seemed to work, but I still couldn’t connect. Based on simos’ response (abt an hour after yours), something changed (?had been deprecated, now has been removed?) with LXD.


#5

Thank you, too, for your response. I’ll attempt the workaround over the weekend. The linked question seems to reflect the problem I am having, so I’m hopeful it will work.


(Thomas Parrott) #6

Yes support for localhost was removed due to potential security issue as it depended on resolver libraries in the container.


#7

Your suggested solution solved the problem. Thank you for the guidance.