Skip to main content
Commonmark migration
Source Link

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

 

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

 

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Drop irrelevant comment.
Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

Let’s get all the heavyweights (by reputation points) weighing in here ;-).

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Let’s get all the heavyweights (by reputation points) weighing in here ;-).

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Source Link
Stephen Kitt
  • 481.5k
  • 60
  • 1.2k
  • 1.4k

Let’s get all the heavyweights (by reputation points) weighing in here ;-).

Two other answers explain what exec "$@" does. This answer on Stack Overflow explains why it’s important for Docker, and as you surmise, it does have to do with signals:

This is important in Docker for signals to be proxied correctly. For example, if Redis was started without exec, it will not receive a SIGTERM upon docker stop and will not get a chance to shutdown cleanly. In some cases, this can lead to data loss or zombie processes.

If you do start child processes (i.e. don't use exec), the parent process becomes responsible for handling and forwarding signals as appropriate. This is one of the reasons it's best to use supervisord or similar when running multiple processes in a container, as it will forward signals appropriately.

Post Made Community Wiki by Stephen Kitt