0

I have a docker image consisting of two microservice. When we deploy it, through docker stack deploy, both the services starts running. Inside the Dockerfile, I have used supervisor. Now, I would like to control the startup of the microservice via supervisor script. I have used following :

[program:zookeeper]
startsecs=60
directory= /app
command=/bin/bash -c "java -jar zoo.jar"
priority=1
autostart = true
autorestart = true

[program:kafka]
startsecs=60
directory= /app
command=/bin/bash -c "java -jar kaf.jar"
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
priority=999
autostart = true
autorestart = true

So, basically before starting kafka, zookeeper should be up and running. I have used the above scrip in supervisor.conf file but it is not working. How to achieve this.

Thanks Kumar Shorav

Kumar
  • 955
  • 5
  • 20
  • 50
  • Almost always, you'd run two separate services like this in two separate containers. This is especially true for services that you'd want to scale differently and that have different storage requirements. – David Maze Feb 28 '20 at 11:56
  • @DavidMaze Hi David, Thanks for your comment. Do You mean, we need to have two seperate image for two different service? If I am having only one image but need to control sequence of service startup, den what would be correct way? – Kumar Mar 02 '20 at 06:20
  • [Docker Compose wait for container X before starting Y](https://stackoverflow.com/questions/31746182/docker-compose-wait-for-container-x-before-starting-y) describes this (it generally involves putting some logic in your container startup so isn't really that Compose-specific). – David Maze Mar 02 '20 at 11:00

0 Answers0