0

I am trying to start a few services in my container when it stars.

This is my entry_point script:

#!/bin/bash
set -e

mkdir -p /app/log
tail -n 0 -f /var/log/*.log &
tail -n 0 -f ./log/current.log &
# Start Gunicorn processes
#echo Starting Nginx.
#exec /etc/init.d/nginx start

echo Starting Gunicorn.
exec gunicorn app.main:app \
    --name price_service \
    -c config/gunicorn.conf  \
    "$@"

What i would like todo is to uncomment this line :

 #exec /etc/init.d/nginx start

But at startup the container just hangs here.

Any solutions ?

Roman
  • 7,933
  • 17
  • 56
  • 72

1 Answers1

1

You should read about http://man7.org/linux/man-pages/man3/exec.3.html to see what it is doing.

What you need is to either to background the process using & (not recommended), or use a process manager or init system (see Can I run multiple programs in a Docker container?, also not really recommended).

Or you can run multiple containers, and use docker-compose to manage them (recommended).

Community
  • 1
  • 1
dnephin
  • 25,944
  • 9
  • 55
  • 45