# Running a Command When a Docker Container Starts

**URL:** <https://forums.docker.com/t/running-a-command-when-a-docker-container-starts/23924>\
**Category:** General\
**Created:** [October 26, 2016, 5:51am UTC](https://forums.docker.com/t/running-a-command-when-a-docker-container-starts/23924 "2016-10-26T05:51:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amithaprabath](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@amithaprabath](https://forums.docker.com/u/amithaprabath)\
**Post date:** [October 26, 2016, 5:51am UTC](https://forums.docker.com/t/running-a-command-when-a-docker-container-starts/23924/1 "2016-10-26T05:51:13Z")

</div>

Hi,

I want to run a command when a docker container starts. I am creating a **mirth software container** and I want to run " **/pathto-mirth-folder/mcserver start**" command. How can I achieve this while creating a docker file?

I want to know another thing. Can cron jobs be run inside a docker container? I tried **@reboot** option in a container to run the above command when the docker container stops and start again, but it seems that it is not working( I have committed the container as well).

Thanks.
