# Start a service inside docker container automaticly

**URL:** <https://forums.docker.com/t/start-a-service-inside-docker-container-automaticly/101530>\
**Category:** Docker Hub\
**Tags:** docker\
**Created:** [December 9, 2020, 8:08am UTC](https://forums.docker.com/t/start-a-service-inside-docker-container-automaticly/101530 "2020-12-09T08:08:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zamgamg](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/zamgamg/32/32657_2.png) [@zamgamg](https://forums.docker.com/u/zamgamg)\
**Post date:** [December 9, 2020, 8:08am UTC](https://forums.docker.com/t/start-a-service-inside-docker-container-automaticly/101530/1 "2020-12-09T08:08:43Z")

</div>

I’ve been running a Docker container for a year or so now, the dockerfile doesn’t exist. Now I want the cron.d service to run automatically in this container (`/etc/init.d/cron start`). I already found a solution on stackoverflow:  
`CMD /etc/init.d/cron start`

Now the container is already running and I don’t have a dockerfile in which I can use it to rebuild the container. I am confused at this point. How can I use `CMD` in a running container? Sure, I can stop it too, but that doesn’t help me because I don’t know how the command should be implemented without a dockerfile.

---

<div class="post-metadata">

**Author:** ![zamgamg](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/zamgamg/32/32657_2.png) [@zamgamg](https://forums.docker.com/u/zamgamg)\
**Post date:** [December 20, 2020, 5:08pm UTC](https://forums.docker.com/t/start-a-service-inside-docker-container-automaticly/101530/4 "2020-12-20T17:08:41Z")

</div>

problem still exists

---

<div class="post-metadata">

**Author:** ![mbutterfield44](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mbutterfield44](https://forums.docker.com/u/mbutterfield44)\
**Post date:** [December 30, 2020, 1:06am UTC](https://forums.docker.com/t/start-a-service-inside-docker-container-automaticly/101530/5 "2020-12-30T01:06:55Z")

</div>

If you want to bust into the container and run that command just:

docker exec -it containerid terminal

Sorry, not a full-time unix person but you just need to enter a command that will give you a prompt. In windows it would be something like ‘powershell’ or ‘cmd’. Hope this helps.

Or you could just docker exec -t containerid /etc/init.d/cron start

so you could script this.
