GalaxyData Community

docker-compose autostart almalinux 8 and almalinux 9

new file

nano /etc/systemd/system/docker-compose-app.service

add file

[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

systemctl enable docker-compose-app
systemctl start docker-compose-app

 

Exit mobile version