Docker compose yml static IP addressing

In my case is i first run docker-compose up failed, but the network already created, can see using docker network ls.

In this case, just docker-compose down, fix the yml, rerun docker-compose up is fine

[SOLVED] Found the solution. When pointing to the network, we should use flag "external" telling compose that network is already created and should be taken outside (otherwise it will be created on the fly with project prefix):

    external: true

So, after that docker-compose will attach containers to existing app_subnet Before that the subnet must be created:

docker network create --gateway --subnet app_subnet