Connect: Bad Request ("container sharing network namespace with another container or host cannot be connected to any other network")

I am using the Torizon plugin in VSCode and need to add the option network_mode= host in my container in extraparms. I am trying to make a dbus server.

However, I am getting an error when debugging as follows.

Remote docker exception. :: Error (525) - Docker exception: 400 Client Error for http://127.0.0.1:35551/v1.40/networks/edc472aead9c9585caf3d73176438bd0ec1a09c005cd4882ef6fd153c034694f/connect: Bad Request (“container sharing network namespace with another container or host cannot be connected to any other network”)
device:07028204.

When i remove the network_mode =host option, this error goes away.
Why is this happening?

Hi @SJ_BHD ,

This can happen if you have the networks field with at least one entry alongside network_mode as host: they’re not compatible, given that the container cannot connect to another network if it’s already using the host network.

Check if the networks field has any entry in it, and remove it if that’s the case.

Let me know if this helps you.

Best regards,
Lucas Akira

Hi @SJ_BHD !

Do you have news about your issue? Could you follow @lucas_a.tx’s idea?

Let us know :slight_smile:

Best regards,