Docker container with redis runned as daemon doesn't run


I have simple Dockerfile



And in my entrypoint I'm setting up some configurational keys and set some data to redis via node:



Image builds succesfully, but when I running it - nothing happens. What's the problem? What should I do to run redis in container and make some configuration after? May be the trouble is in that I'm running redis as daemon?



Answer from author



TL:DR



There is a pretty similiar question in Stackoverflow which help to fix my problem:



The problem was in that a Docker ENTRYPOINT or CMD should "spawn single process". And I put Redis starting and node init.js execution as different programs into supervisord. Providing supervisord.conf for example:



Why did I do that?



The main trouble which I have with this issue was with misunderstanding what actually is a Docker container. And what does ENTRYPOINT or CMD in Docker. I thought that I should just "run some server into Docker and expose some port and Docker will do everything with itself", but that is not the way how containers work. There is a difference between containers and VM's. Look this: How is Docker different from a virtual machine?



When thinking about Docker container as a wrap over one single process it seems clear that code written in my Dockerfile will not work in way that I was expected.



If there is a need to run multiple processes in Docker container then you should use something like supervisord or concurrently (if you prefer Node ecosystem).






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

The Dalles, Oregon

眉山市

清晰法令