Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
294 views
in Technique[技术] by (71.8m points)

linux - Systemd service file for running django app using docker

I have a Django application running using the docker containers on my local system. I want to start the application on system reboot. So, I decided to write a systemd service file.

[Unit]
Description=docker_container service

[Service]
WorkingDirectory=/home/sree/Documents/code/solutions_new/solutions/
ExecStart=/usr/bin/docker /usr/bin/docker-compose -f docker-compose_dev.yml up
Restart=always
RestartSec=60
[Install]
WantedBy=multi.user.target

On my system, I usually run the Django app in a virtual environment.Am getting the below error when trying to start the service file

docker_container.service - docker_container service
Loaded: loaded (/etc/systemd/system/docker_container.service; enabled; 
vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2021- 
01-24 09:33:49 PST; 9s ago
Process: 21241 ExecStart=/usr/bin/docker /usr/bin/docker-compose -f 
docker-compose_dev.yml up (code=exited, status=125)
Main PID: 21241 (code=exited, status=125)
question from:https://stackoverflow.com/questions/65874015/systemd-service-file-for-running-django-app-using-docker

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...