您如何 运行 ElasticBeanstalk / Amazon Linux 2 上的容器命令?

How do you run container commands on ElasticBeanstalk / Amazon Linux 2?

我目前在 ElasticBeanstalk 上有一个 Laravel 应用程序 运行,其中包含以下文件 运行 我的部署命令...

.ebextensions/deployment-commands.config

container_commands:
    01-run-migrations:
        command: "php artisan migrate --force"
        cwd: "/var/app/ondeck"
        leader_only: true

我正在尝试将 PHP 版本更新到 7.4,因此我需要升级到 Amazon Linux 2 服务器。此命令似乎不适用于新的 Amazon Linux 2 设置,所以我想知道它是否会再获取 ebextensions,如果是,我是否需要更改 cwd?基本上我需要做什么才能让这个部署命令起作用?

I'm trying to update my PHP version to 7.4 so I need to upgrade to an Amazon Linux 2 server.

不知道你在这里是什么意思,但是从 Amazon Linux 1 (AL1) 升级到 AL2 可能需要比升级 php:

更多的更改

container_commands 运行 在临时文件夹 /var/app/staging 中。但是您正在尝试使用不同的文件夹 /var/app/ondeck,这可能是您看不到命令​​效果的原因。