Hi, i’m not sure if the topic category is right, so correct me if wrong.
I would like to know if it is possible to connect a service to both a custom defined bridge network aswell as to the docker’s predefined host network. In my application i would like to take advantage of docker’s dns resolution between services hence the custom bridge. At the same time however i am developing this application for Basler cameras. It looks like that Basler cameras can be detected inside docker only when using the host network basler docker .
Is it possible to connect a service to both custom-defined bridge network and docker host network?
In the Documentation i could find the following way to have a service to be connected to the host:
services:
web:
networks:
hostnet: {}
networks:
hostnet:
external: true
name: host
but when i try to use:
version: '3.8'
services:
opc_base:
build: ./OPCUA
opcua_server:
build: ./OPCUA/Server
depends_on:
- opc_base
ports:
- "4080:4080"
networks:
- opcua_network
orchestrator:
build: ./OPCUA/Engine
depends_on:
opcua_server:
networks:
- opcua_network
- camera_to_host:{}
networks:
opcua_network:
driver: bridge
camera_to_host:
external: true
name: host
i get the following error:
Error response from daemon: network-scoped alias is supported only for containers in user defined networks
If instead i use the network_mode:host option in compose as follows:
version: '3.8'
services:
opc_base:
build: ./OPCUA
opcua_server:
build: ./OPCUA/Server
depends_on:
- opc_base
ports:
- "4080:4080"
networks:
- opcua_network
orchestrator:
build: ./OPCUA/Engine
depends_on:
opcua_server:
networks:
- opcua_network
network_mode: host
networks:
opcua_network:
driver: bridge
I get the following error message:
Error response from daemon: failed to add interface vetha640e1a to sandbox: error setting interface “vetha640e1a” IP to xxx.xx.0.4/16: cannot program address xxx.xx.0.4/16 in sandbox interface because it conflicts with existing route {Ifindex: 139 Dst: xxx.xx.0.0/16 Src: xxx.xx.0.1 Gw: Flags: Table: 254 Realm: 0}
Other users proposed a workaround as in workaround but this is cumbersome, as the application runs multiple containers.
To Wrap Up:
- How can i connect a container to the host and a custom defined network using compose?
if not possible // does not solve the problem:
- Has anyone experience with Basler cameras inside docker containers? How to use the camera in a bridge network (and not host) ?
My main goal would be to be able to run everything on a bridge, allowing acces to Basler cameras (they use the GenIcam standard). It looks like the GenIcam uses some sort of discovery method that is not allowed inside a container.