Run a Script every time, when the container starts

Hi I’m new at docker and studied lots of threads.
However, I still can’t get it - sorry.

I need to run a script, everytime a container comes up.
As far as I understand it should be this in the Dockerfile:
CMD ["/home/oracle/bin/oracle_start.sh", “start”]
This should run:
/home/oracle/bin/oracle_start.sh start -every time I start the container.

Or is the a user-too-stupid-error?

Thanks
Christian

So, does it run or does it not?
Just be aware of the following: If you type an additional command after docker container run my_container this will override CMD and your script does not start. If you really want to run it all the time you should call it with ENTRYPOINT.

1 Like

Thank for the tip.
If i need to access the container I’ll use
docker exec -it devXE /usr/bin/bash

Well, at first it didn’t run at all. :frowning:
However I changed it to:
exec /home/oracle/scripts/startup.sh
This starts an oracle instance and does a tail -f on alert log.