docker-compose with multiple databases -


i'm trying figure out how implement docker using docker-compose.yml 2 databases imported sql dumps.

httpd:     container_name: webserver     build: ./webserver/     ports:         - 80:80     links:         - mysql         - mysql2     volumes_from:         - app  mysql:     container_name: sqlserver     image: mysql:latest     ports:         - 3306:3306     volumes:         - ./sqlserver:/docker-entrypoint-initdb.d     environment:         mysql_root_password: root         mysql_database: dbname1         mysql_user: dbuser         mysql_password: dbpass  mysql2:     extends: mysql     container_name: sqlserver2     environment:         mysql_root_password: root         mysql_database: dbname2         mysql_user: dbuser         mysql_password: dbpass  app:     container_name: webdata     image: php:latest     volumes:         - ../php:/var/www/html     command: "true" 

the above returns following:

kronos:mybuild avanche$ ./run.sh  creating sqlserver creating webdata creating sqlserver2  error: mysql2  driver failed programming external connectivity on endpoint sqlserver2 (6cae3dfe7997d3787a8d59a95c1b5164f7431041c1394128c14e5ae8efe647a8): bind 0.0.0.0:3306 failed: port allocated traceback (most recent call last):   file "<string>", line 3, in <module>   file "compose/cli/main.py", line 63, in main attributeerror: 'projecterror' object has no attribute 'msg' docker-compose returned -1 

basically, i'm trying whole stack setup in single docker compose file, create 2 databases , import respective sql dumps. have suggestions?

you're trying bind both database containers same port - 3306. impossible. need change port-mapping 1 of databases, example mysql keeps 3306:3306, , mysql2 should use 3307:3306.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -