Deploy of Docker as private service fails with timeout

I created a private service where I deploy a Docker image. It fails after a couple of minutes with a timeout. My supervisor in the container receives a SIGTERM and shuts down. There is nothing in the logs to be found. Locally the container keeps running. What’s going on?

Dockerfile:

FROM joyzoursky/python-chromedriver:3.8-selenium

################

# dependencies #

################

RUN apt-get update && \

apt-get -y install libblas-dev liblapack-dev libatlas-base-dev gfortran supervisor cron

# set display port to avoid crash

ENV DISPLAY=:99

# Copy the app

WORKDIR /app

COPY ./src /app

# Install requirements

RUN pip install --upgrade pip

RUN pip install Cython --install-option="--no-cython-compile"

RUN pip install -r /app/requirements.txt

# Configure cron jobs, and ensure crontab-file permissions

COPY config/cronjobs /etc/crontabs/root

RUN chmod 0644 /etc/crontabs/root

# Apply cron job

RUN crontab /etc/crontabs/root

# Setup supervisord

COPY config/supervisord.conf /etc/supervisor/

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]

Log Output:

Apr 14 05:47:08 PM  2021-04-14 15:47:08,112 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend to run as root, you can set user=root in the config file to avoid this message.
Apr 14 05:47:08 PM  2021-04-14 15:47:08,114 INFO supervisord started with pid 1
Apr 14 05:47:09 PM  2021-04-14 15:47:09,117 INFO spawned: 'cron' with pid 8
Apr 14 05:47:10 PM  2021-04-14 15:47:10,118 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Apr 14 06:01:26 PM  2021-04-14 16:01:26,479 WARN received SIGTERM indicating exit request
Apr 14 06:01:26 PM  2021-04-14 16:01:26,479 INFO waiting for cron to die
Apr 14 06:01:26 PM  2021-04-14 16:01:26,479 INFO stopped: cron (terminated by SIGTERM)

Supervisord config

[supervisord]
nodaemon=true
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
nodaemon=true
[program:cron]
command = /bin/bash -c "declare -p | grep -Ev '^declare -[[:alpha:]]*r' > /run/supervisord.env && /usr/sbin/cron -f -L 15"
stdout_logfile = /dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes=0
user = root
autostart = true
autorestart = true

Hey Ole,

Thanks for posting this issue! I believe the issue here is that you’re using a private service instead of a background worker. If you take a look at the events tab on your service, the deploys are timing out, which is most likely the cause of the SIGTERM you are seeing.

Private services are expected to listen on port 10000 (or a port of your specification). If it doesn’t, it will fail a health check and the service will be killed.

Can you try to do the same build as a background worker and let me know the results? Thanks!

Note: as an aside, I see the program in your SupervisorD configuration is called cron, we have native cronjobs if that’s something you might be interested in.

1 Like

Hey Oliver, that was indeed the case. Thanks for the great support.