Ref: https://www.howtogeek.com/devops/how-to-assign-a-static-ip-to-a-docker-container/
Setting Up Static IPs
First, you’ll need to set up a Docker network, and since we care about the IP address, you’ll need to specify a fixed subnet:
docker network create --subnet=172.20.0.0/16 customnetwork
Then, you can run a container, specifying the network with the --net
flag, and specifying the IP with the -ip
flag:
docker run --net customnetwork --ip 172.20.0.10 -d container