How to gracefully stop a Dockerized Python ROS2 node when run with docker-compose up?
问题 I have a Python-based ROS2 node running inside a Docker container and I am trying to handle the graceful shutdown of the node by capturing the SIGTERM / SIGINT signals and/or by catching the KeyboardInterrupt exception. The problem is when I run the node in a container using docker-compose . I cannot seem to catch the "moment" when the container is being stopped/killed. I've explicitly added the STOPSIGNAL in the Dockerfile and the stop_signal in the docker-compose file. Here is a sample of