Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run supervisord with pid 1 #419

Merged
merged 1 commit into from
May 31, 2022

Conversation

ryoluo
Copy link
Contributor

@ryoluo ryoluo commented May 28, 2022

Problem

When we stop the containers, laravel.test is exited with code 137 (SIGKILL).
This is because supervisord is not running with pid 1.

$ docker-compose up
laravel.test_1  | 2022-05-28 19:13:18,824 INFO supervisord started with pid 9
$ docker-compose stop
$ docker-compose ps
        Name                   Command           State     Ports
----------------------------------------------------------------
sample_laravel.test_1   start-container         Exit 137        
sample_mysql_1          /entrypoint.sh mysqld   Exit 0    

Solution

At start-container script, use exec command to run supervisord. It makes it possible to replace the current process (pid 1).
Now, supervisord is started with pid 1 and we can stop the container with exit code 0.

$ docker-compose up
laravel.test_1  | 2022-05-28 19:33:08,619 INFO supervisord started with pid 1
$ docker-compose stop
$ docker-compose ps
        Name                   Command           State     Ports
----------------------------------------------------------------
sample_laravel.test_1   start-container         Exit 0        
sample_mysql_1          /entrypoint.sh mysqld   Exit 0    

@taylorotwell taylorotwell merged commit 04b4259 into laravel:1.x May 31, 2022
@ryoluo ryoluo deleted the run-supervisord-with-pid-1 branch May 31, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants