gpt4 book ai didi

django - 将Django Docker容器部署到弹性beantalk

转载 作者:行者123 更新时间:2023-12-02 19:45:40 25 4
gpt4 key购买 nike

我有一个配置了nginx + gunicorn的django rest框架应用程序。我可以使用docker-compose up -d --build在本地运行容器,但我希望将docker镜像部署到AWS Elastic beantalk。
出于调试目的,我正在尝试eb local run,但似乎出现此错误:

latest: Pulling from <user>/<repo>
Digest: sha256:15cec14272aca0b787c4209e3196b2e61d50732f6f4616f2cf50baa28b82c65c
Status: Image is up to date for <user>/<repo>:latest
docker.io/<user>/<repo>:latest
Sending build context to Docker daemon 316.7MB
Step 1/2 : FROM <user>/<repo>:latest
---> eex74e02e4e5
Step 2/2 : EXPOSE 8000
---> Using cache
---> 094f132e13a7
Successfully built 094f132e13a7
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
docker: invalid reference format.
See 'docker run --help'.
ERROR: CommandError - None
这是我的Dockerrun.aws.json:
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<user>/<repo>:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "8000"
}
]
}
如果我实际部署到EB,我会在日志中看到以下错误:
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Aug 15 22:26:00 ip-172-31-24-230 web: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
Aug 15 22:26:00 ip-172-31-24-230 web: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
Aug 15 22:26:00 ip-172-31-24-230 web: File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
Aug 15 22:26:00 ip-172-31-24-230 web: ModuleNotFoundError: No module named 'application'
Aug 15 22:26:00 ip-172-31-24-230 web: [2020-08-15 22:26:00 +0000] [3815] [INFO] Worker exiting (pid: 3815)
Aug 15 22:26:00 ip-172-31-24-230 web: [2020-08-15 22:26:00 +0000] [3808] [INFO] Shutting down: Master
Aug 15 22:26:00 ip-172-31-24-230 web: [2020-08-15 22:26:00 +0000] [3808] [INFO] Reason: Worker failed to boot.
Aug 15 22:26:00 ip-172-31-24-230 web: [2020-08-15 22:26:00 +0000] [3820] [INFO] Starting gunicorn 20.0.4
Aug 15 22:26:00 ip-172-31-24-230 web: [2020-08-15 22:26:00 +0000] [3820] [INFO] Listening at: http://127.0.0.1:8000 (3820)
为什么会出现此错误?

最佳答案

要在EB上使用docker,您有两种选择:

  • 一个single Docker平台
  • 一个Multicontainer Docker平台

  • 由于您正在使用 Dockerrun.aws.json v1,因此应使用 Docker running on 64bit Amazon Linux 2/3.1.0平台(单个docker),而不是 Python 3.7 running on 64bit Amazon Linux 2/3.1.0
    受支持的单 docker 平台的列表为 here
    在控制台中它将是:
    enter image description here

    关于django - 将Django Docker容器部署到弹性beantalk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63431850/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com