dcsg is a command-line utility for Linux that generates systemd services for Docker Compose projects.
If you have one or more docker compose projects running on your server you might want create a systemd service for each of them.
And dcsg is here to help you with just that. Quickly create systemd services from docker-compose files.
dcsg <action> [<path-to-a-docker-compose-file>] [<docker-compose-project-name]>
Register a Docker Compose project as a systemd service:
dcsg install docker-compose.yml
Uninstall the systemd service for the given Docker Compose project:
dcsg uninstall docker-compose.yml
Show the available actions and arguments:
dcsg help
The help for a specific action:
dcsg install --help
dcsg doesn't do much.
For the install
action dcsg creates a systemd service (see: installer.go):
- Create a systemd service definition in
/etc/systemd/system/<project-name>.service
- Execute systemctl
daemon-reload
,enable
andstart
The name of the service created will be the project name of your docker-compose project.
For the uninstall
action dcsg remove the systemd service it created earlier (see: uninstaller.go):
- Execute a systemctl
stop
anddisable
for the docker-compose service - Delete the systemd service definition from
/etc/systemd/system/<project-name>.service
- Execute sytemctl
daemon-reload
You can download pre-built binaries for Linux (64bit, ARM 5, ARM 6 and ARM 7) from github.com » andreaskoch » dcsg » releases:
- Download for dcsg (Linux 64bit)
- Download for dcsg (Linux ARM5)
- Download for dcsg (Linux ARM6)
- Download for dcsg (Linux ARM7)
curl -L https://github.com/andreaskoch/dcsg/releases/download/v0.4.0/dcsg_linux_amd64 > /usr/local/bin/dcsg
chmod +x /usr/local/bin/dcsg
If you have go installed you can use go get
to fetch and build dcsg:
go get github.com/andreaskoch/dcsg
To cross-compile dcsg for the different Linux architectures (AMD64, ARM5, ARM6 and ARM7) you can use the crosscompile
action of the make script:
go get github.com/andreaskoch/dcsg
cd $GOPATH/github.com/andreaskoch/dcsg
make crosscompile
»dcsg« is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.