You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@airflow.apache.org by Anthony Joyce <an...@omicronmedia.com> on 2021/08/21 18:26:52 UTC
Execute bash command after image startup
Hi all,
I want to execute a bash command inside a container after it has already started up. For example, I would like to execute an ssh command that forwards a port from the host to the container. I would like to automate this using the docker-compose.yaml if I can. I am using the official apache-airflow container image. How would I go about doing this?
Thanks!
Anthony
Re: Execute bash command after image startup
Posted by Anthony Joyce <an...@omicronmedia.com>.
Thanks again Jarek. That was one of the formats I didn’t try. Appreciate you!
Anthony
On Aug 21, 2021, at 3:46 PM, Jarek Potiuk <ja...@potiuk.com>> wrote:
The image has entrypoint that accepts `bash` command and when you run your docker-compose, you are free to provide any startup command (as long as you continue using the default entrypoint)
Your docker compose entries can specify any bash command to run for your docker containers, for example:
airflow-worker:
command:
- bash
- -c
- |
run_your_command_here
airflow worker
This will run "run_your_command_here" before starting the worker.
--
+48 660 796 129
Re: Execute bash command after image startup
Posted by Jarek Potiuk <ja...@potiuk.com>.
BTW. You can read more about the "official image" entrypoint and
particularly about running commands here (
https://airflow.apache.org/docs/docker-stack/entrypoint.html#executing-commands
):
On Sat, Aug 21, 2021 at 9:46 PM Jarek Potiuk <ja...@potiuk.com> wrote:
> The image has entrypoint that accepts `bash` command and when you run your
> docker-compose, you are free to provide any startup command (as long as you
> continue using the default entrypoint)
>
> Your docker compose entries can specify any bash command to run for your
> docker containers, for example:
>
> airflow-worker:
> command:
> - bash
> - -c
> - |
> run_your_command_here
> airflow worker
>
>
> This will run "run_your_command_here" before starting the worker.
>
> --
> +48 660 796 129
>
--
+48 660 796 129
Re: Execute bash command after image startup
Posted by Jarek Potiuk <ja...@potiuk.com>.
The image has entrypoint that accepts `bash` command and when you run your
docker-compose, you are free to provide any startup command (as long as you
continue using the default entrypoint)
Your docker compose entries can specify any bash command to run for your
docker containers, for example:
airflow-worker:
command:
- bash
- -c
- |
run_your_command_here
airflow worker
This will run "run_your_command_here" before starting the worker.
--
+48 660 796 129