Amazon web services 在AWS Dockerrun.AWS.json文件中添加Docker运行命令选项

Amazon web services 在AWS Dockerrun.AWS.json文件中添加Docker运行命令选项,amazon-web-services,docker,amazon-elastic-beanstalk,Amazon Web Services,Docker,Amazon Elastic Beanstalk,在docker-compose.yml文件中,我可以执行以下操作: splash: image: scrapinghub/splash command: --max-timeout 300 ports: - "8050:8050" { "name": "splash", "image": "scrapinghub/splash", ... "command": [ "--max-timeout 300" ] },

在docker-compose.yml文件中,我可以执行以下操作:

splash:
  image: scrapinghub/splash
  command: --max-timeout 300
  ports:
    - "8050:8050"
{
    "name": "splash",
    "image": "scrapinghub/splash", 
    ...
    "command": [
        "--max-timeout 300"
    ]
},
如您所见,我只是传入了要添加到在图像中执行的docker run命令中的附加选项

当我尝试将此应用于部署到Amazon Elastic Beanstalk的Dockerrun.aws.json文件时,我在编写以下内容时出错:

splash:
  image: scrapinghub/splash
  command: --max-timeout 300
  ports:
    - "8050:8050"
{
    "name": "splash",
    "image": "scrapinghub/splash", 
    ...
    "command": [
        "--max-timeout 300"
    ]
},

所以问题是,如何将-max timeout参数添加到Docker映像在AWS部署中执行的默认命令中?

您无法通过使用Docker运行选项自定义AWS启动容器的方式。您必须使用.ebextensions。 如果要增加超时时间,请在ZIP包的.ebextensions子目录中创建一个文件,该文件应已包含dockrun.aws.json文件:

option_settings:
  - namespace: aws:elb:policies
    option_name: ConnectionSettingIdleTimeout
    value: 300
  - namespace: aws:elasticbeanstalk:command
    option_name: Timeout
    value: 300
  - namespace: aws:elbv2:loadbalancer
    option_name: IdleTimeout
    value: 300