How to fix the frontend container IP address?

The IP address of the containers are generate different each time when I run the docker compose -f pwd.yml up -d

How to fix the IP address without modifing the pwd.yml?

Check docker documentation for that.

We cannot do anything that docker cannot do.

I only found two ways, docker run --ip and editing compose yaml to set ip.

I found the solution, first, create a docker network

$ docker network create --subnet=192.168.8.0/24 my_custom_network

Create the override.yml for assigning IP addresses

	version: "3"
	services:
	  frontend:
	    networks:
	      my_custom_network:
	        ipv4_address: 192.168.8.13

	networks:
	  my_custom_network:
	    external: true

Create the containers with override
$ docker compose -f pwd.yml -f overrride.yml up -d

This way I can always access to ERPNext with 192.168.8.13:8080

1 Like