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 年前檢視次數 878 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南