Container can't access internet if set static ip

Hello. I have 2+ ips and want assign one of them to container but internet in container doesn’t work when using that ips.

I created network with

docker network create --driver=bridge --subnet= br0

command and started container with

docker run -it --network=br0 --ip= ubuntu /bin/bash

but can’t access to internet can’t use apt update etc

You can not assign a host ip to a container. Though, you can publish ports that only listen on a specific ip: docker run ... -p{host port}:{container port} ...

The response packages will still use the default gateway, the same is true for egress traffic initiated from the container to a remote host.

… or you could use docker run ... --network=host ... - but it will use all network interfaces, and not just one.

is there any way I can assign that ip to container ?