How to run docker-compose up -d at system start up?
On Linux

Usually, systemd (or upstart) is used to manage which services start when the system boots. You can try use the similar configuration for this:

File: /etc/systemd/system/docker-compose-app.service

[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/srv/docker
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0

[Install]
WantedBy=multi-user.target

Or, if you want run without the -d flag:

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

[Unit]
Description=Docker Compose Application Service
Requires=docker.service
After=docker.service

[Service]
WorkingDirectory=/srv/docker
ExecStart=/usr/local/bin/docker-compose up
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0
Restart=on-failure
StartLimitIntervalSec=60
StartLimitBurst=3

[Install]
WantedBy=multi-user.target

Change the WorkingDirectory parameter with your dockerized project path. And enable the service to start automatically:

systemctl enable docker-compose-app

-----

DO NOT CLICK THIS https://bit.ly/3biXWMc

Videos fill be uploaded regularly, so subscribe our youtube Channel.

Visit YouTube Channel http://youtube.com/odooindonesia

Untuk trik Odoo lainnya bisa cek Udemy courses http://udemy.com/user/akhmaddaniel

Visit official site http://vitraining.com

One Touch and Go Live with Odoo http://1toucherp.com

Twitter http://Twitter.com/akhdaniel 

Check our blog: http://indonesia.odoo.com


How to run docker-compose up -d at system start up?
vitraining, odoo indonesia
16 June, 2020
Share this post
Archive
Sign in to leave a comment
Practical Tricks to Create your Custom Odoo Docker Image
Udemy Course: How to dockerize your custom Odoo in simple steps