Skip to content

Instantly share code, notes, and snippets.

@willscripted
Created September 2, 2015 19:00
Show Gist options
  • Save willscripted/68670640648d0bae8574 to your computer and use it in GitHub Desktop.
Save willscripted/68670640648d0bae8574 to your computer and use it in GitHub Desktop.
docker upstart example
[Unit]
Description=Documentation for my app
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Environment="PROJECT_API_URL=https://path.to.place.com"
ExecStartPre=-/usr/bin/docker kill myapp
ExecStartPre=-/usr/bin/docker rm myapp
ExecStartPre=-/usr/bin/docker pull quay.io/will_ob/myrepo:production-current
ExecStart=/bin/bash -c "/usr/bin/docker run -P \
--name myapp \
-e PROJECT_API_URL=$PROJECT_API_URL \
quay.io/will_ob/myrepo:production-current"
ExecStop=/usr/bin/docker stop myapp
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment