I have a docker linked to a bridge with IP address 192.168.150.1/24
.
Once I create the docker instance from a docker image it gets an IP address, 192.168.150.2
, but according to my requirement, this IP address, 192.168.150.2
, must be reserved since I want to use it for some other thing.
Now, I want to change the IP address of this docker instance as 192.168.150.3
. Is it possible to do? if so how? Please, help.
You will have to first detach the container from the custom network and the connect it back by providing the ip.
You can follow the following steps :
docker network disconnect [OPTIONS] NETWORK CONTAINER
docker network connect --ip 192.168.150.3 NETWORK CONTAINER
You can specify a particular IP address when you define the port mapping, for example
-p 192.168.150.3:6379:6379
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With