Conatiner to container communication

Hi,
i am newbie to LXC container.i would like to know is there any way to handle communication between two specific container.
If anyone has a clue how to handle this,please let me know.or point me to doc which explaining communication between containers.

thanks

Hi,

There are lots of different networking options available, but it sounds like the simplest for you would be either bridge (which would allow containers to communicate with each other and the host) or macvlan (which would allow containers to communicate with each other and the rest of the network, but not the host).

You would need to create a bridge device first on your host, then you can connect your containers to it.

Take a look at the networking section of the LXC documentation: https://linuxcontainers.org/lxc/manpages//man5/lxc.container.conf.5.html

Thanks
Tom

Hi,
Thanks for the quick reply tomp.I have created a bridge device to connect host with containers,so that containers shares host’s network through the bridge and they have unique IP as well.So can you suggest a networking option to handle this??

Hi @sreegin

If you already have a bridge device (and the host’s physical interface is connected to it), then you can connect LXC containers to it using this config:

lxc.net.0.type = veth
lxc.net.0.flags = up
lxc.net.0.ipv4.address = 192.168.0.x/24
lxc.net.0.ipv4.gateway = 192.168.0.x
lxc.net.0.link = br0

Hi @tomp,
I could tranfer files from host to container using the network,But couldn’t transfer between containers.Is there common memory that can be shared between container without interventions of host.

@sreegin please can you provide the full network config for all containers and the host, along with example ping tests of what works and what doesnt work.

Thanks
Tom

Container1:Xenial01
#network configuration
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags =up
container2:Xenial02,network configuration is same for both.
Host:Raspberry pi.
#network configuration
auto br0
iface br0 inet dhcp
bridge_ports usb0 //Network through usb tethering.
bridge_fd 0
bridge_maxwait 0.
Method used to transfer file from host to container:
scp file.txt ubuntu@192.168.42.68:/container directory (/var/lib/lxc//rootfs/home/<directory