附加的是我的docker-compose文件。它是一個非常簡單的項目,有一個數據庫和phpmyadmin來訪問它。Docker-Compose Up Works但Eb Local Run不是
web:
build: ./docker_web/
links:
- db
ports:
- "80:80"
volumes:
- "./docker_web/www/:/var/www/site"
db:
image: mysql:latest
restart: always
volumes:
- "./.data/db:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: ^^^^
MYSQL_DATABASE: electionbattle
MYSQL_USER: admin
MYSQL_PASSWORD: ^^^^
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: phpmyadmin
environment:
- PMA_ARBITRARY=1
restart: always
ports:
- 8081:80
volumes:
- /sessions
links:
- db
如果我運行它,它工作正常。我爲Amazon Elastic Beanstalk的Docker Run創建了Equivlent,並啓動它,但由於某種原因,它找不到在.data文件夾中保留持久數據庫數據的卷。
我試過改變.data只是數據沒有運氣。
此外,我試圖做eb deploy
2016-09-24 19:56:10 UTC-0700 ERROR ECS task stopped due to: Essential container in task exited. (db: CannotCreateContainerError: API error (500): create ./.data/db/: "./.data/db/" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed web: phpmyadmin:)
我不知道如何解決這個錯誤,或者爲什麼事情發生時,你得到一個奇怪的錯誤。有任何想法嗎?
哎呀忘了添加我的亞馬遜文件:)。
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "web",
"host": {
"sourcePath": "./docker_web/www/"
}
},
{
"name": "db",
"host": {
"sourcePath": "./data/db/"
}
}
],
"containerDefinitions": [
{
"name": "web",
"image": "197984628663.dkr.ecr.us-west-1.amazonaws.com/electionbattleonline",
"memory": 200,
"essential": true,
"mountPoints": [
{
"sourceVolume": "web",
"containerPath": "/var/www/site",
"readOnly": false
}
],
"links": [
"db"
],
"portMappings": [
{
"hostPort": 80,
"containerPort": 80
}
]
},
{
"name": "db",
"image": "mysql:latest",
"environment": [
{
"name": "MYSQL_ROOT_PASSWORD",
"value": "^^^^"
},
{
"name": "MYSQL_DATABASE",
"value": "electionbattleonline"
},
{
"name": "MYSQL_USER",
"value": "admin"
},
{
"name": "MYSQL_PASSWORD",
"value": "^^^^"
}
],
"portMappings": [
{
"hostPort": 3306,
"containerPort": 3306
}
],
"mountPoints": [
{
"sourceVolume": "db",
"containerPath": "/var/lib/mysql",
"readOnly": false
}
],
"essential": true,
"memory": 200
},
{
"name": "phpmyadmin",
"image": "phpmyadmin/phpmyadmin",
"environment": [
{
"name": "PMA_ARBITRARY",
"value": "1"
}
],
"essential": true,
"memory": 128,
"links": [
"db"
],
"portMappings": [
{
"hostPort": 8081,
"containerPort": 80
}
]
}
]
}
這是上面的整個撰寫文件嗎?你不是在用'version:「2」'? – Alkaline
是它的整個文件,docker-compose和它的計數器部分Dockerrun.aws.json –
有趣的是,我擺脫了db容器,並且當我嘗試部署時,現在爲web容器提供了同樣的錯誤?多麼奇怪......它不像卷裝? –