use*_*089 18 django amazon-ecs docker amazon-elastic-beanstalk docker-compose
我按照https://docs.docker.com/compose/django/上的说明获取基本的dockerized django应用程序.我可以在本地运行它而没有问题,但我无法使用Elastic Beanstalk将其部署到AWS.在这里阅读之后,我想我需要将docker-compose.yml翻译成Dockerrun.aws.json才能工作.
原始的docker-compose.yml是
version: '2'
services:
db:
image: postgres
web:
build: .
command: python manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
- db
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止翻译的内容
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "db"
},
{
"name": "web"
}
],
"containerDefinitions": [
{
"name": "db",
"image": "postgres",
"essential": true,
"memory": 256,
"mountPoints": [
{
"sourceVolume": "db"
"containerPath": "/var/app/current/db"
}
]
},
{
"name": "web",
"image": "web",
"essential": true,
"memory": 256,
"mountPoints": [
{
"sourceVolume": "web"
"containerPath": "/var/app/current/web"
}
],
"portMappings": [
{
"hostPort": 8000,
"containerPort": 8000
}
],
"links": [
"db"
],
"command": "python manage.py runserver 0.0.0.0:8000"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我究竟做错了什么?
Sam*_* H. 22
我很难弄清楚这种Dockerrun格式的来龙去脉.查看容器转换:"转换docker-compose,ECS和Marathon配置"......它可以节省生命.以下是为您的示例输出的内容:
{
"containerDefinitions": [
{
"essential": true,
"image": "postgres",
"name": "db"
},
{
"command": [
"python",
"manage.py",
"runserver",
"0.0.0.0:8000"
],
"essential": true,
"mountPoints": [
{
"containerPath": "/code",
"sourceVolume": "_"
}
],
"name": "web",
"portMappings": [
{
"containerPort": 8000,
"hostPort": 8000
}
]
}
],
"family": "",
"volumes": [
{
"host": {
"sourcePath": "."
},
"name": "_"
}
]
}
Container web is missing required parameter "image".
Container web is missing required parameter "memory".
Container db is missing required parameter "memory".
Run Code Online (Sandbox Code Playgroud)
也就是说,在这种新格式中,您必须告诉它分配每个容器的内存量.此外,您需要提供图像 - 没有选项可以构建.正如评论中提到的,您希望构建并推送到DockerHub或ECR,然后将其提供给该位置:例如,[org name]/[repo]:latest在Dockerhub上,或ECR的URL.但container-transform确实在mountPoints和volumes你-这是惊人的.
| 归档时间: |
|
| 查看次数: |
8568 次 |
| 最近记录: |