Hi,
I’m experiencing different behaviours when using docker-compose to link 2 containers.
I’m linking SonarQube with MySQL: if I run the command id est:
docker-compose -f docker-compose.yml up
then the 2 containers are regularly created without any issues.
if I delete the 2 containers and re-run it with “-d” option id est:
docker-compose -f docker-compose.yml up -d
the 2 containers are created but the one with sonarqube dies after 10 second because unable to find mysql.
you can test it with standard mysql and sonarqube containers
here’s the compose file
sonarqube:
image: sonarqube
ports:
- “9000:9000”
- “9092:9092”
- "3306:3306"
environment: - SONARQUBE_JDBC_USERNAME=sonar
- SONARQUBE_JDBC_PASSWORD=sonar
- SONARQUBE_JDBC_URL=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
db:
image: mysql:latest
net: container:sonarqube
environment: - MYSQL_ROOT_PASSWORD=sonar
- MYSQL_DATABASE=sonar
- MYSQL_USER=sonar
- MYSQL_PASSWORD=sonar
Thanks in advice
Emanuele