I am trying to run a Docker container as a router between a private (--internal
) Docker network and the predefined host
network. This means the container needs to have two network interfaces: One "outside" interface, that can access all host IP addresses, and one "inside" interface, that acts as a gateway for the containers in the internal Docker network
The router container itself will then NAT network traffic from/to containers.
I have not found a way to configure Docker to run the container with those two interfaces. The closest I could get is having two bridge
interfaces assigned, which is not exactly what I need.
Trying to connect manually results in an error:
# docker network connect host root_router_1
Error response from daemon: Container cannot be disconnected from host network or connected to host network
Can anybody show me how to achieve this, preferably even whith Docker Compose?