将参数传递给在AWS Fargate上的Docker容器中运行的Python [英] Pass arguments to Python running in Docker container on AWS Fargate

查看:160
本文介绍了将参数传递给在AWS Fargate上的Docker容器中运行的Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以像这样将参数传递给运行Python脚本的Docker容器

Passing arguments to a Docker container running a Python script can be done like so

docker run my_script:0.1 --arg1 val --arg2 val ...

我似乎无法弄清楚在AWS Fargate上运行容器时如何传递这些参数(也许不起作用?)

I can't seem to figure out how to pass those arguments when running the container on AWS Fargate (perhaps it doesn't work?)

推荐答案

您可以使用容器定义参数以传递运行时参数.

You can use container definitions parameters in ECS task definition to pass runtime arguments.

Command 参数映射到docker run中的COMMAND参数.

Command parameter maps to COMMAND parameter in docker run.

"command": [
  "--arg1",
  "val",
  "--arg2",
  "val"
],

还可以将参数作为环境变量进行传递.

It is also possible to pass parameters as environment variables.

"environment": [
  {
    "name": "LOG_LEVEL",
    "value": "debug"
  }
],

这篇关于将参数传递给在AWS Fargate上的Docker容器中运行的Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆