Skip to content

Instantly share code, notes, and snippets.

@scottslowe
Last active December 11, 2016 16:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottslowe/dc3cadbfbfd3ae3ebe08 to your computer and use it in GitHub Desktop.
Save scottslowe/dc3cadbfbfd3ae3ebe08 to your computer and use it in GitHub Desktop.
This systemd unit can be modified slightly (change the filename and the container name) to run multiple Docker containers across hosts in an etcd/fleet cluster.
[Unit]
Description=Nginx web front-end
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull nginx
ExecStart=/usr/bin/docker run --rm --name nginx-01 -p 80:80 nginx
ExecStop=/usr/bin/docker stop nginx-01
[X-Fleet]
X-Conflicts=nginx.*.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment