Within your Dockerfile you have to EXPOSE the ports that you want to use e.g. EXPOSE 8080 on NGINX. Afterwards, you can define your own network in the docker-compose.yml file therefore you need to define the network e.g. some-network and provide a subnet range like 172.20.0.0/16. Afterwards you can assign the IPs you would like towards your services in the docker-compose.yml file. As you showed, the network section is already implemented, you just need to adjust it. Firstly change the default name towards your newly defined network name ( some-network ) and as a subsection of that you can add a e,g, ipv4_address: 172.20.0.5. Afterwards this container is reachable under 172.20.0.5:8080. This information can be used as information channel of your application. An example can be found here https://docs.docker.com/compose/networking/
FROM continuumio/miniconda3
...
EXPOSE 8080
docker-compose.yml:
...
nginx:
image: nginx
container_name: "nginx"
build:
context: ..
dockerfile: docker/nginx/Dockerfile
restart: always
networks:
some-network:
ipv4_address: 172.20.0.5
networks:
some-network:
config:
- subnet: 172.20.0.0/16