List all the docker networks:
~> docker network ls NETWORK ID NAME DRIVER SCOPE
6632005b7b01 bridge bridge local
446a6bafd4ce host host local
efde81885e68 keycloak_default bridge local
3c1e0372f203 mysql-compose_default bridge local
Add a service into one of the networks.
services:
keycloak:
image: quay.io/keycloak/keycloak:latest
environment:
DB_VENDOR: MYSQL
DB_ADDR: 172.19.0.2
DB_DATABASE: keycloak
DB_USER: root
DB_PASSWORD: password
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: Pa55w0rd
# Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the MySQL JDBC driver documentation in order to use it.
#JDBC_PARAMS: "connectTimeout=30000"
ports:
- 8090:8080
networks:
- mysqlnetwork
networks:
mysqlnetwork:
name: mysql-compose_default
Check service's ip in docker network:
docker network inspect mysql-compose_default
Reset docker network:
docker network prune
docker-compose down
docker-compose up