0

I have a Dockerfile with a CMD, it calls a .sh file that runs a Django app ( makemigrations, migrate and uwsgi ) And that runs fine in a pod.

There's a django admin script that runs infinitely that I'd like to run in the same pod.

  • Per the docker docs I can't have a second command in the Dockerfile
  • Adding the script on the sh file wouldn't work because the both processes ( the app or command script ) are running and don't end so the second one never runs.
    • If I go in the pod and run exec -it bash to manually run the script i can't leave the pod without killing the process (Ctrl-C) or can I?

Any suggestions?

0

Though it's not advised to have multiple processes inside a container, but you have 2 options:

Use a process manager like supervisord or wrapper script to use as CMD (meta code)

start_first_process_in_bg
if START_FAILED
  exit
start_second_process_in_bg
if START_FAILED
  exit

while sleep 5; do
  check_first_process
  check_second_process

  if ANY_PROCESS_FAILED; then
    exit
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.