I trying to use multiple command at my container. If I just add plain CMD command at the end of Dockerfile, it’s will not working. The best way to use multiple command at Dockerfile is to use supervisord. Here the example:
- Create supervisor config file, in this example I have to running 2 command, 1 to serve reactjs app & 1 json-server to serve image from CDN.

Example Supervisor Config
-
At the end of your Dockerfile, change it to
CMD ["/usr/bin/supervisord"]
. Don’t forget to expose your application port and add command to copy your supervisor configCOPY spv.conf /etc/supervisor/conf.d/
-
In the docker-compose just add other port services, in my case
ports:
- '127.0.0.1:666:3000'
- '127.0.0.1:999:3001'
That’s it, just run your dockerfile, hope it work well ;)

Jika kamu merasa tulisan ini bermanfaat & membantu kamu, kamu bisa berdonasi lewat saweria
If you feel this website help you, you can donate at saweria