new file
1 |
nano /etc/systemd/system/docker-compose-app.service |
add file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
[Unit] Description=Docker Compose Application Service Requires=docker.service After=docker.service [Service] Type=oneshot RemainAfterExit=yes WorkingDirectory=/root ExecStart=/usr/local/bin/docker-compose up -d ExecStop=/usr/local/bin/docker-compose down TimeoutStartSec=0 [Install] WantedBy=multi-user.targe |
where
WorkingDirectory=/root
is directory file docker-compose.yml
then
1 2 |
systemctl enable docker-compose-app systemctl start docker-compose-app |