github.com/didip/deis@v1.4.1/deisctl/units/deis-database.service (about) 1 [Unit] 2 Description=deis-database 3 4 [Service] 5 EnvironmentFile=/etc/environment 6 TimeoutStartSec=20m 7 ExecStartPre=/bin/sh -c "docker inspect deis-database-data >/dev/null 2>&1 || docker run --name deis-database-data -v /var/lib/postgresql ubuntu-debootstrap:14.04 /bin/true" 8 ExecStartPre=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/database` && docker history $IMAGE >/dev/null || docker pull $IMAGE" 9 ExecStartPre=/bin/sh -c "docker inspect deis-database >/dev/null 2>&1 && docker rm -f deis-database >/dev/null 2>&1 || true" 10 ExecStart=/bin/sh -c "IMAGE=`/run/deis/bin/get_image /deis/database` && docker run --name deis-database --volumes-from=deis-database-data -p 5432:5432 -e EXTERNAL_PORT=5432 -e HOST=$COREOS_PRIVATE_IPV4 $IMAGE" 11 ExecStopPost=-/usr/bin/docker exec deis-database sudo service postgresql stop 12 ExecStopPost=-/usr/bin/docker rm -f deis-database 13 Restart=on-failure 14 RestartSec=5 15 16 [Install] 17 WantedBy=multi-user.target