App Runner Execute command


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?


asked 10 months ago703 views
1 Answer

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
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions