elasticbeanstalk多容器将不会从中选择最新的图像

问题描述 投票:0回答:1

我有一个带有Dockerrun.aws.json文件的多容器的python服务器设置,该文件从ECR中拾取图像:

{
"AWSEBDockerrunVersion": 2,
"volumes": [
    {
        "host": {
            "sourcePath": "API"
        },
        "name": "_Api"
    }
],
"containerDefinitions": [
    {
        "essential": true,
        "Update": true,
        "memory": 128,
        "name": "my_api",
        "image": "xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1",
        "mountPoints": [
            {
                "containerPath": "/code",
                "sourceVolume": "_Api"
            }
        ]
    },
    {
        "essential": true,
        "memory": 128,
        "name": "nginx",
        "image": "xxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/dashboard-nginx:test1",
        "portMappings": [
            {
                "containerPort": 80,
                "hostPort": 80
            }
        ],
         "links": [
             "my_api"
         ]
    },
    {
        "essential": true,
        "memory": 128,
        "name": "redis",
        "image": "redis:latest",
        "portMappings": [
            {
                "containerPort": 6379,
                "hostPort": 6379
            }
        ]
    }
]

我已经对容器进行了一些修改,希望使用eb local run命令在本地对其进行测试但是无论我做什么,都是使用原始的旧图片

我在EB之前使用了一个并行的docker-compose.yml-可以正常工作:

       version: '3'
services:
   my_api:
       image: xxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1
       build: ./API
       expose:
           - "5555"
       volumes:
           - ./API:/code
       depends_on:
           - redis
   redis:
       image: redis:latest
       networks:
         - service
       ports:
           - "6379:6379"
       expose:
           - "6379"
   nginx:
       image: xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1
       build:
           context: ./API
           dockerfile: Dockerfile-nginx
       ports:
           - 80:80
       depends_on:
           - my_api

我尝试使用docker-compose进行构建和推送。以及docker和新标签等但是我仍然得到相同的行为

。elasticbeanstalk / docker-compose.yml文件似乎已更新,但是即使运行docker-compose up --build它仍然使用旧图像

我尝试运行docker system prune -a来让eb拉出新的带标签的容器-但仍然,以某种方式,我又得到了旧图像

即使部署到AWS的行为也相同

[当我运行docker ps -a时,我可以看到所使用的容器只是名称不同而使用不同的图像ID:

89b258852e84        xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1   "nginx -g 'daemon of…"   9 minutes ago       Exited (0) 5 minutes ago                       dashboard-nginx
23196d6e8016        xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1     "uwsgi --ini app.ini"    9 minutes ago       Exited (0) 5 minutes ago                       dashboard-api
95b4473bc38f        redis:latest                                                         "docker-entrypoint.s…"   9 minutes ago       Exited (0) 5 minutes ago                       live_dashboard_redis_1
32be5539e905        xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-nginx:test1   "nginx -g 'daemon of…"   10 minutes ago      Exited (0) 6 minutes ago                       elasticbeanstalk_nginx_1
51d89fcdfd94        redis:latest                                                         "docker-entrypoint.s…"   10 minutes ago      Exited (0) 6 minutes ago                       elasticbeanstalk_redis_1
e10715455525        xxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/my-api:test1     "uwsgi --ini app.ini"    10 minutes ago      Exited (0) 6 minutes ago                       elasticbeanstalk_myapi_1

我错过了什么或没有完全理解?有什么方法可以让eb本地重建并在本地使用最新映像?为什么EB在部署时不拉Image的最新版本?任何帮助或建议,将不胜感激

EDIT1

我收集了更多信息当我检查docker-compose镜像和eb镜像时,我看到它们有一个不同的Mount部分,该部分可以解释代码差异:

docker-compose

"Mounts": [
   {
       "Type": "bind",
       "Source": "/host_mnt/c/Workspaces/PRJ/DevOps/Tools/proj/API",

       "Destination": "/code",

       "Mode": "rw",
       "RW": true,
       "Propagation": "rprivate"
   }
]

eb:


       "Mounts": [
           {
               "Type": "volume",
               "Name": "API",
               "Source": "/var/lib/docker/volumes/API/_data",
               "Destination": "/code",
               "Driver": "local",
               "Mode": "rw",
               "RW": true,
               "Propagation": ""
           }
       ]

我在Windows上工作很奇怪

amazon-web-services docker-compose amazon-elastic-beanstalk amazon-ecr
1个回答
0
投票

[几天后通过电话获得AWS支持最后我们得到了答案因此,如果将来有人遇到这种情况,则需要检查安装设置

从/ var / app / current / API进行音量选择

"volumes": [
    {
        "host": {
            "sourcePath": "/var/app/current/API"
        },
        "name": "_Api"
    }
],
© www.soinside.com 2019 - 2024. All rights reserved.