Docker Community Forums

Share and learn in the Docker community.

How to create more than one virtual network interface (veth) on a container via docker

Hello,

I’m working on a task to create a docker container for an image that runs multiple instances on the main host.

The instances are like containers themselves that support all container functionality and run in their own network namespaces with their own virtual network interface (veth).

To create a container for this sort of image, I have to somehow create a container that runs multiple containers inside the main container itself. The sub-containers (called instances) run in their own network namespaces and have their own virtual network interfaces.

Container runtimes use veth devices to give containers network devices, I should be able to use those for the virtual interface. The question is how to get docker to give me more than one device on a container.

Do anyone of you know a lot about docker container networking and can show me how to get docker to create more than one virtual network interface on a container? Another requirement is that the virtual interfaces cannot be created from the main container because then they wouldn’t be accessible from outside the container. They have to be created by docker itself.

Thank you so much!