mirror of
https://github.com/Brandon-Rozek/website.git
synced 2025-10-09 14:31:13 +00:00
Website snapshot
This commit is contained in:
parent
ee0ab66d73
commit
50ec3688a5
281 changed files with 21066 additions and 0 deletions
46
content/blog/composesystemd.md
Normal file
46
content/blog/composesystemd.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
---
|
||||
title: "Ensuring Docker Compose Startup with Systemd"
|
||||
date: 2019-12-16T20:57:36-05:00
|
||||
draft: false
|
||||
images: []
|
||||
---
|
||||
|
||||
I've been having trouble getting some docker containers such as `nginx` to start automatically on bootup, even with the `restart: always` flag.
|
||||
|
||||
To compensate, I wrote a small systemd script and enabled it on startup.
|
||||
|
||||
`/etc/systemd/system/docker-compose.service`
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Docker Compose Application Service
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=brandonrozek
|
||||
Group=brandonrozek
|
||||
RemainAfterExit=yes
|
||||
WorkingDirectory=/home/brandonrozek/docker/
|
||||
ExecStart=/usr/bin/docker-compose up -d
|
||||
ExecStop=/usr/bin/docker-compose down
|
||||
TimeoutStartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
||||
```
|
||||
|
||||
To enable on startup
|
||||
|
||||
```bash
|
||||
sudo systemctl enable docker-compose
|
||||
```
|
||||
|
||||
To start now
|
||||
|
||||
```bash
|
||||
sudo systemctl start docker-compose
|
||||
```
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue