Skip to main content
The 2024 Developer Survey results are live! See the results
added 42 characters in body
Source Link
Attie
  • 20.2k
  • 5
  • 60
  • 78

Let me re-organised the question. I have used a similar docker-compose yaml file as below. version: "3" services: app: build: ./app networks: - frontend

networks: frontend: driver: bridge ipam: config: - subnet: 172.38.3.0/24

version: "3"
services:
  app:
    build: ./app
    networks:
      - frontend
 
networks:
  frontend:
     driver: bridge
     ipam:
       config:
         - subnet: 172.38.3.0/24

A network interface eth0eth0 will be created automatically inside the dock container APP. I can connect to the network of the host through eth0eth0.

Now I want to create other virtual network interfaces inside the docker container APP, such as veth1veth1, veth2veth2. I want to let the packets through veth1veth1/veth2veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

ping -I veth1 host-network-ip

by the way, I have tried to define one more network in the yaml and attached to docker container APP. but unfortunately, the network interface name 'eth1'eth1 inside docker container could not be customized. I need to specify the network interface name.

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

Let me re-organised the question. I have used a similar docker-compose yaml file as below. version: "3" services: app: build: ./app networks: - frontend

networks: frontend: driver: bridge ipam: config: - subnet: 172.38.3.0/24

A network interface eth0 will be created automatically inside the dock container APP. I can connect to the network of the host through eth0.

Now I want to create other virtual network interfaces inside the docker container APP, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

by the way, I have tried to define one more network in the yaml and attached to docker container APP. but unfortunately, the network interface name 'eth1' inside docker container could not be customized. I need to specify the network interface name.

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

Let me re-organised the question. I have used a similar docker-compose yaml file as below.

version: "3"
services:
  app:
    build: ./app
    networks:
      - frontend
 
networks:
  frontend:
     driver: bridge
     ipam:
       config:
         - subnet: 172.38.3.0/24

A network interface eth0 will be created automatically inside the dock container APP. I can connect to the network of the host through eth0.

Now I want to create other virtual network interfaces inside the docker container APP, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

by the way, I have tried to define one more network in the yaml and attached to docker container APP. but unfortunately, the network interface name eth1 inside docker container could not be customized. I need to specify the network interface name.

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

added 512 characters in body
Source Link

ILet me re-organised the question. I have used a similar docker-compose yaml file as below. version: "3" services: app: build: ./app networks: - frontend

networks: frontend: driver: bridge ipam: config: - subnet: 172.38.3.0/24

A network interface eth0(attach one docker network,created by docker will be created automatically) inside my dockerthe dock container, through eth0, APP. I can connect to the network of the host through eth0.

Now I want to create other virtual network interfaces inside the docker container APP, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

by the way, I have tried to define one more network in the yaml and attached to docker container APP. but unfortunately, the network interface name 'eth1' inside docker container could not be customized. I need to specify the network interface name.

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

I have a network interface eth0(attach one docker network,created by docker automatically) inside my docker container, through eth0, I can connect to the network of the host.

Now I want to create other virtual network interfaces inside the docker container, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

Let me re-organised the question. I have used a similar docker-compose yaml file as below. version: "3" services: app: build: ./app networks: - frontend

networks: frontend: driver: bridge ipam: config: - subnet: 172.38.3.0/24

A network interface eth0 will be created automatically inside the dock container APP. I can connect to the network of the host through eth0.

Now I want to create other virtual network interfaces inside the docker container APP, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

by the way, I have tried to define one more network in the yaml and attached to docker container APP. but unfortunately, the network interface name 'eth1' inside docker container could not be customized. I need to specify the network interface name.

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!

Source Link

How to bridge a virtual interface inside docker container?

I have a network interface eth0(attach one docker network,created by docker automatically) inside my docker container, through eth0, I can connect to the network of the host.

Now I want to create other virtual network interfaces inside the docker container, such as veth1, veth2. I want to let the packets through veth1/veth2 can access the host network. Like the below,

ping -I veth1 host-network-ip

Is it possible to let it work? if yes, can you please help to explain how to do? Thank you very much!