Skip to content

Instantly share code, notes, and snippets.

@gdoteof
Created March 2, 2015 23:36
Show Gist options
  • Save gdoteof/ba8d7f9e6cc0c30cc95e to your computer and use it in GitHub Desktop.
Save gdoteof/ba8d7f9e6cc0c30cc95e to your computer and use it in GitHub Desktop.
Description=My thing
# Requirements
Requires=etcd.service
Requires=docker.service
# Dependency ordering
After=etcd.service
After=docker.service
[Service]
# Let processes take awhile to start up (for first run Docker containers)
TimeoutStartSec=0
# work correctly.
KillMode=none
# Get CoreOS environmental variables
EnvironmentFile=/etc/environment
# Pre-start and Start
ExecStartPre=-/usr/bin/docker kill mything-%i
ExecStartPre=-/usr/bin/docker rm mything-%i
ExecStartPre=/usr/bin/docker pull gdoteof/my-image
ExecStart=/usr/bin/docker run -d --name mything-%i gdoteof/my-image my_command $VAR1 $VAR2 $VAR3
# Stop
ExecStop=/usr/bin/docker stop mything-%i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment