Run docker container as service in Ubuntu

cd  /etc/systemd/system

sudo nano oh-dbms.service 


#write the bellow configuration and save

[Unit]
Description=Open Hospital DBMS

[Service]
ExecStart=/home/USER/git/run-db.sh

[Install]
WantedBy=multi-user.target


systemctl daemon-reload


systemctl enable oh-dbms.service
nano /home/USER/git/run-db.sh
chmod +x /home/USER/git/run-db.sh
#!/bin/bash
docker-compose -f /home/USER/git/openhospital-core/docker-compose.yml up -d;
Chinese (Simplified) Chinese (Simplified) Dutch Dutch English English French French German German Italian Italian Russian Russian