Docker container with multiple networks route table not expected #49414
Replies: 1 comment 3 replies
-
Hi @kevinmatthe,
The next moby and compose releases will have a With a bit of luck, moby 28.0 will ship this week. I'm not sure about the release date for Compose but it'll also be soon. (At the moment, the gateway network is the one that sorts first alphabetically. So, at-least it is deterministic.)
I'm not able to reproduce that. For me, the ping works without needing to add the route ... which seems right, with the macvlan network using its default "-o macvlan_mode bridge". Pinging the host's address from the container on the same L2-network shouldn't need a route or gateway - it should just ARP, get a response, then send packets directly. I guess that's not happening in your case - but it's all kernel routing, not something docker is directly involved in once the networks are configured. Do you have any default network options set up in your |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For my typical usage, I need to create a container over 2 docker networks:
Pre-Info
Networks:
test_bridge
: this is a bridge network to allowworkload_container
<=docker-dns=>other_container
amcnet
: this is a macvlan network to publish a static ip in LAN, this is for some device to directly access by LAN ip locally, for example theworkload_container
here goes192.168.31.180
Problem
Steps to reproduce
1. Create test_bridge and amcnet networks:
2. Create dockerfile and compose.yaml file
3. Build & Run the container
1. ping 192.168.31.74
docker compose run \ --rm \ --build \ --remove-orphans \ network_test \ /bin/bash -c "route && ping 192.168.31.74"
output:
2. Add route then ping
docker compose run \ --rm \ --build \ --remove-orphans \ network_test \ /bin/bash -c "route add -net 192.168.31.0/24 gw 192.168.31.1 && route && ping 192.168.31.74"
Output:
Summary
The only difference I saw here is in route table:
default
in route table is not working?Beta Was this translation helpful? Give feedback.
All reactions