how to add new service in ubuntu docker image?

by Sollosa   Last Updated July 12, 2019 13:00 PM - source

I'm building a docker image & inside it I need gunicorn service to serve django with nginx reverse proxying.

The build process works fine, but I noticed it doesn't recognize gunicorn service when I start it like this

# systemctl start gunicorn

the gunicorn file's supposed to be copied in /etc/systemd/system directory. I started to investifate by opening a bash session into container, and noticed following.

  1. systemd is not present inside ubuntu:latest docker image
  2. service files are not inside /etc/systemd/system directory rather inside /lib/systemd/system directory
  3. even if I use service command, it says unrecognized service.

    service gunicorn start

Below are the contents of my service file

cat /etc/systemd/system/gunicorn.service

Description=gunicorn daemon

ExecStart=/usr/local/gunicorn --access-logfile - --workers 3 --bind unix:/app/gunicorn.sock myproject.wsgi:application


so does anyone have any idea of it, and suggest me how to make this custom service work inside this image/container??

Tags : ubuntu service

Related Questions

varnish daemon not listening on configured port

Updated January 05, 2017 08:00 AM

OpenDKIM starts before MariaDB on Ubuntu 18.04

Updated August 01, 2018 13:00 PM