Docker - array vs string based CMD
Docker best practice:
Use array over string syntax in your Dockerfiles to handle signals properly:
# array (exec) CMD ["gunicorn", "-w", "4", "-k", "uvicorn.workers.UvicornWorker", "main:app"] # string (shell) CMD "gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app"
Using the string form causes Docker to run your process using bash, which doesn't handle signals properly. Since most shells don't process signals to child processes, if you use the shell format, CTRL-C (which generates a SIGTERM) may not stop a child process.