Created
March 21, 2018 12:50
-
-
Save rkachowski/7ece584243a26a7ac1b8fdf25d358be0 to your computer and use it in GitHub Desktop.
example systemd unit for docker container
This file contains hidden or 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=Nginx webserver | |
Requires=docker.service | |
[Service] | |
ExecStartPre=/bin/sleep 1 | |
ExecStartPre=/usr/bin/docker pull nginx:alpine | |
ExecStart=/usr/bin/docker run --name nginx -v /mnt/vdb/nginx/config/conf.d:/etc/nginx/conf.d:ro -v /mnt/vdb/nginx/config/conf:/etc/nginx/conf:ro -v /mnt/vdb/nginx/certs:/tls -v /mnt/vdb/nginx/static:/static -p 443:443 -p 80:80 nginx:alpine | |
ExecStop=/usr/bin/docker stop nginx | |
ExecStopPost=/usr/bin/docker rm -f nginx | |
ExecReload=/usr/bin/docker restart nginx | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment