Created
January 22, 2017 15:32
-
-
Save stefanahman/e835eb3302ab081297168f7790dcdc2c to your computer and use it in GitHub Desktop.
Docker service template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=<user> docker container | |
After=docker.service | |
Requires=docker.service | |
[Service] | |
User=<user> | |
TimeoutStartSec=0 | |
ExecStartPre=-/usr/bin/docker kill <user> | |
ExecStartPre=-/usr/bin/docker rm <user> | |
ExecStartPre=/usr/bin/docker pull docker pull <repo> | |
ExecStart=/usr/bin/docker run \ | |
--name <user> \ | |
--privileged \ | |
-e PGID=<pgid> -e PUID=<puid> \ | |
-e TZ=Europe/Berlin \ | |
-p <port>:<port> \ | |
<repo> | |
Restart=always | |
RestartSec=5 | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment