supervisorctl이란 무엇인가? - 도커 컨테이너 내에서 여러 프로세스 실행하기
supervisorctl
: 유닉스 계열의 시스템에서 여러 프로세스를 모니터링하고 제어하는 프로그램
: 손쉽게 프로세스의 상태를 보여주고 죽은 프로세스도 자동으로 살려줌
: 한 번 실행된 프로그램이 절대로 꺼지지 않도록 도와줌
구성
- supervisor: 프로그램
- supervisord: supervisor 데몬 프로세스
- supervisorctl: supervisor로 구동되는 프로세스를 관리하기 위한 명령어
구성 파일
- /etc/supervisord.conf
# cat supervisord.conf
[supervisord]
nodaemon=true
[program:httpd]
command=/usr/sbin/httpd -k start
[program:vsftpd]
command=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
출처: https://engineer-mole.tistory.com/231 [매일 꾸준히, 더 깊이:티스토리]
공식 문서
Configuration File — Supervisor 4.2.5 documentation
The command that will be run when this program is started. The command can be either absolute (e.g. /path/to/programname) or relative (e.g. programname). If it is relative, the supervisord’s environment $PATH will be searched for the executable. Programs
supervisord.org
도커에서 사용하기
: 전통적으로 Docker 컨테이너는 실행 시 1개의 프로세스를 실행할 수 있다
: 프로세스 관리 툴을 사용하여 컨테이너의 CMD 명령으로 bash 스크립트를 실행하면 컨테이너 내에서 여러 프로세스를 관리할 수 있다 (프로세스 재실행까지 가능)
: Docker 컨테이너에서는 "프로세스가 Foreground로 실행되지 않으면 컨테이너는 종료된다"는 제약이 있는데, supervisor라는 툴을 사용하면 이를 해결할 수 있다
- 사용법
: /etc/su
Reference
Ubuntu Manpage: supervisorctl - supervisorctl Documentation
Powered by the Ubuntu Manpage Repository, file bugs in Launchpad © 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.
manpages.ubuntu.com
Supervisor
Supervisor란?
velog.io
[Docker] Supervisor을 Docker에서 사용하기
Supervisor이란? 전통적(?)으로 Docker 컨테이너는 실행시에 1개의 프로세스를 실행한다. 예를 들어, Apache 데몬이나 SSH 서버의 데몬과 같은 것이 있다. 그러나 컨테이너 내에서 여러 개의 프로세스를
engineer-mole.tistory.com