我正在尝试将一个dockerized应用程序部署到弹性beanstalk。上传包含Dockerrun.aws.json
文件的zip文件后,控制台返回
2018-05-09T20:08:15Z }'
2018-05-09T20:08:15Z + local 'CONTAINER_STOPPED_REASONS=web: CannotCreateContainerError: API error (400): create .: volume name is too short, names should be at least two alphanumeric characters
2018-05-09T20:08:15Z
2018-05-09T20:08:15Z db: '
2018-05-09T20:08:15Z + '[' -n 'Essential container in task exited' ']'
2018-05-09T20:08:15Z + error 'ECS task stopped due to: Essential container in task exited. (web: CannotCreateContainerError: API error (400): create .: volume name is too short, names should be at least two alphanumeric characters
2018-05-09T20:08:15Z
2018-05-09T20:08:15Z db: )'
2018-05-09T20:08:15Z + echo 'ECS task stopped due to: Essential container in task exited. (web: CannotCreateContainerError: API error (400): create .: volume name is too short, names should be at least two alphanumeric characters
2018-05-09T20:08:15Z
2018-05-09T20:08:15Z db: )'
2018-05-09T20:08:15Z ECS task stopped due to: Essential container in task exited. (web: CannotCreateContainerError: API error (400): create .: volume name is too short, names should be at least two alphanumeric characters
2018-05-09T20:08:15Z
2018-05-09T20:08:15Z db: )
2018-05-09T20:08:15Z + eventHelper.py --msg 'ECS task stopped due to: Essential container in task exited. (web: CannotCreateContainerError: API error (400): create .: volume name is too short, names should be at least two alphanumeric characters
2018-05-09T20:08:15Z
2018-05-09T20:08:15Z db: )' --severity ERROR
我查看了我的Dockerrun.aws.json
文件,但没有小于2个字符的卷名,我将文件中的所有.
字符更新为this
或{{1我看过帖子说可能有解决Windows问题的路径,但我不知道如何解决它。
我提供了Code
和docker-compose.yml
文件以供参考。
搬运工-compose.yml:
Dockerrun.aws.json
Dockerrun.aws.json:
version: '3'
services:
db:
image: postgres:10.1
environment:
- POSTGRES_USER=name
- POSTGRES_PASSWORD=password
- POSTGRES_DB=db1
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data/
web:
image: rdeng/test:latest
build: this
environment:
- RDS_DB_NAME=db1
- RDS_USERNAME=name
- RDS_HOSTNAME=db
- RDS_PASSWORD=password
- RDS_PORT=5432
command: bash -c "python /code/manage.py makemigrations && python /code/manage.py migrate && python /code/manage.py runserver 0.0.0.0:8000"
volumes:
- this:/code
ports:
- "8000:8000"
depends_on:
- db
volumes:
postgres_data:
我还在我的目录中添加了一个{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"environment": [
{
"name": "POSTGRES_USER",
"value": "name"
},
{
"name": "POSTGRES_PASSWORD",
"value": "password"
},
{
"name": "POSTGRES_DB",
"value": "db1"
}
],
"essential": true,
"image": "postgres:10.1",
"mountPoints": [
{
"containerPath": "/var/lib/postgresql/data/",
"sourceVolume": "Postgres_Data"
}
],
"name": "db",
"memory":64,
"portMappings": [
{
"containerPort": 5432,
"hostPort": 5432
}
]
},
{
"command": [
"bash",
"-c",
"python /code/manage.py makemigrations && python /code/manage.py migrate && python /code/manage.py runserver 0.0.0.0:8000"
],
"environment": [
{
"name": "RDS_DB_NAME",
"value": "db1"
},
{
"name": "RDS_USERNAME",
"value": "name"
},
{
"name": "RDS_HOSTNAME",
"value": "db"
},
{
"name": "RDS_PASSWORD",
"value": "password"
},
{
"name": "RDS_PORT",
"value": "5432"
}
],
"essential": true,
"memory":64,
"image": "dockerhubstuff/test:latest",
"mountPoints": [
{
"containerPath": "/code",
"sourceVolume": "code"
}
],
"name": "web",
"portMappings": [
{
"containerPort": 8000,
"hostPort": 8000
}
]
}
],
"family": "",
"volumes": [
{
"host": {
"sourcePath": "postgres_data"
},
"name": "Postgres_Data"
},
{
"host": {
"sourcePath": "."
},
"name": "code"
}
]
}
文件,其中包含包含此行的.env
文件
docker-compose.yml
但仍然会出现同样的错误