We have set up a linux server which hosts several ERPNext sites as LXD containers. The trick is to use NAT (network address translation). You can use iptables to accomplish that.
First you need to create firewall rules which specify:
- the interface (for example: eth0, enp0s25, etc)
- which ports are allowed to connect to
- optionally, where do you allow connections from
Then you need to create NAT rules which specify:
- interface in which the translated packets come from
- protocol (TCP)
- port that was used originally
- destination to which the packets are forwarded
iptables -A PREROUTING -i eth0 -p tcp -m tcp --dport 5001 -j DNAT --to-destination 10.0.12.2:80
This assumes your ethernet interface is eth0 and the original port was 5001. All packets to eth0’s port 5001 are then forwarded to 10.0.12.2 port 80.
You can check which IP addresses are assigned to LXD containers by entering the command: lxc list
wow, thanks @tatu. It’s always phantastic to see issues are being picked up even after a long time.
Would you mind to specify the version of LXD you are using? I’m pretty certain that LXD networking is going though some changes between different version of yet young LXD.
Client version: 3.0.1
Server version: 3.0.1
Was a document or presentation created? I will appreciate if this is available. Thank you.
An LXD image will be awesome to have. Was there any progress on this?
- not that I am aware of.
- I have been able to install in an LXD container a long time ago and failed ever since. Can’t say this is due to try running inside an LXC/LXD Container or because the
install.py just loves to not work
if I where you I’d try any of the existing manual installation how-to’s just inside a container
please let us know which how-to has worked for you in the end, ok?
I’ve been using ERPNext on LXD for months. You can follow easiest installation here