I hope someone can help me. I will start by explaining that I am very much still learning docker.
I am using a docker image downloaded from dockerhub which runs a particular app called cgate. I have created a container in my QNAP container station and everything seems to work.
However I also want to run a nodejs script called cgateweb on the same docker container. I can run ‘nodejs /usr/local/bin/cgateweb/index.js’ and it does as expected however I cannot for the life of me work out how to load it on startup.
I initially started by trying init.d, rc.local and cron @reboot but I soon found none of these worked. As mentioned, quite new to docker and soon realised my understanding of it was lacking and that generally you can’t use the normal startup methods in a container.
I tried to instead use CMD or ENTRYPOINT but I am having issues doing this. Currently the cgate container I downloaded has the following ‘command’ (Qnap’s GUI field for CMD):
/bin/sh -c “/etc/init.d/cgatesh start && /bin/bash”
Is there an easy way I can either add to the CMD above (worked out how to do on QNAP) without needed to create a dockerfile? Unfortunately the author of the docker image I downloaded doesn’t have a dockerfile for me to modify so I am doing an export/import of the container which allows me to change the CMD. I have also installed some extra applications such as nodejs which I am unsure on how to do with the dockerfile if I had it.
Sorry this may not make much sense (struggling myself) but if anyone can give me an easy way I can add the auto startup of the .js file I am wanting to use, you’ll be my friend forever.