So I have a docker image Vidyo/mediabridge I want to automatically run some scripts that starts a task inside the container on startup So when I run my image as:
docker run vidyo/mediabridge
OR
dockerfile:
from vidyo/mediabridge
docker execution:
docker build . -tag basicimage
docker run basicimage
I get output as
*** Running /etc/my_init.d/00_regen_ssh_host_keys.sh...
*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 8
but when I edit the image and run it as dockerfile:
from vidyo/mediabridge
CMD echo "hi"
it gives output as
hi
and exits, So basically my base image vidyo/mediabridge is not running, futhur when I try to execute other commands such as
dockerfile
from vidyo/mediabridge
ENTRYPOINT curl $s3path -o /opt/vidyo/config && sleep 10 && ./opt/vidyo/connect
it shows
* syslog-ng is not running
* Starting system logging syslog-ng
* Retrying
and then it exist, can anyone help, I think my base image vidyo/mediabridge is not running properly. is there as way to run the base image and then execute the commands.
When you add a CMD or ENTRYPOINT it overrides the CMD or ENTRYPOINT on the base image that you are using.
To extend this image do no add another CMD or ENTRYPOINT. If you want to add RUN's to execute things they will work.
Note that you do not have to add either of the above commands to your Dockerfile. The parent image's will persist as long as you don't add more.
If you want to modify the CMD or add to it; I would recommend docker inspect image vidyo/mediabridge
, getting the command or ENTRYPOINT that your base container is running and adding that to the end of a shell script that you run as your CMD.