App Runner Execute command

0

Hey there,

Recently started using AWS App Runner. The initial experience has been great so far, but I'm unable to find any resources on what's the best way (if any) to execute a command inside our container.

We run containerized Laravel, and pull the image from ECR. On the first set up, we need to run a specific command inside the container, that sets up some of our stuff, like Databases, and so on...

Is there a way to execute commands in App Runner at the application's root?

Thanks,

已提问 1 年前877 查看次数
1 回答
1

If you're building your App Runner service from a repository, you can specify a Dockerfile to build your container image. In this Dockerfile, you can use the RUN command to execute commands during the build process. This is a good place to run setup tasks that only need to be run once.

If you need to run commands every time your container starts, you could use an entrypoint script in your Docker container. This is a script that is executed every time your container is started, and you can use it to run setup tasks. In the Dockerfile, you can set this script as the entrypoint using the ENTRYPOINT command.

When you configure your service in App Runner, you have the option to specify a start command. This command is run every time a new instance of your service is started. Depending on your application, you might be able to use this to run setup tasks.

profile picture
专家
已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则