Start docker-compose with supervisor.
How manager docker-compose application with supervisor. Easy.
sudo nano /etc/supervisor/cond.d/app.conf
[supervisord] nodaemon=false environment=HOME="/usr/bin/",USER="username" [program:app] command=docker-compose up process_name=%(program_name)s ; process_name expr (default %(program_name)s) numprocs=1 ; number of processes copies to start (def 1) directory=/docker-compose/app ; directory to cwd to before exec (def no cwd) priority=1000 ; the relative start priority (default 999) autostart=true ; start at supervisord start (default: true) autorestart=unexpected ; whether/when to restart (default: unexpected) startsecs=10 ; number of secs prog must stay running (def. 1) startretries=25 ; max # of serial start failures (default 3) ;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2) stopsignal=INT ; signal used to kill process (default TERM) stopwaitsecs=15 ; max num secs to wait b4 SIGKILL (default 10) stopasgroup=false ; send stop signal to the UNIX process group (default false) killasgroup=false ; SIGKILL the UNIX process group (def false) stderr_logfile=/var/log/node_exporter.err ; stdout log path, NONE for none; default AUTO stdout_logfile_maxbytes=0 ; max # logfile bytes b4 rotation (default 50MB) stdout_logfile=/var/log/node_exporter.log ; stderr log path, NONE for none; default AUTO stderr_logfile_maxbytes=0 ; max # logfile bytes b4 rotation (default 50MB) stderr_logfile_backups=5 ; # of stderr logfile backups (default 10) stderr_events_enabled=true [include] files = /etc/supervisor/conf.d/*.conf
Then update supervisor
sudo supervisorctl reread sudo supervisorctl update
And start our application with name app
sudo supervisorctl start app
And stop our application with name app
sudo supervisorctl stop app