我试图弄清楚如何使用docker-compose.yml和从sql转储导入的2个数据库来实现docker.
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"
以上返回以下内容:
Kronos:mybuild avanche$./run.sh
Creating sqlserver
Creating webdata
Creating sqlserver2
ERROR: for MysqL2 driver Failed programming external connectivity on endpoint sqlserver2 (6cae3dfe7997d3787a8d59a95c1b5164f7431041c1394128c14e5ae8efe647a8): Bind for 0.0.0.0:3306 Failed: port is already allocated
Traceback (most recent call last):
File "
基本上,我正在尝试将整个堆栈设置放在一个docker compose文件中,创建2个数据库并导入相应的sql转储.
有人有什么建议吗?
最佳答案