add default & remove bash

master
will Farrell 2017-01-22 12:32:01 -07:00
parent fd20e0227f
commit 6d04eaf0b0
3 changed files with 7 additions and 11 deletions

View File

@ -1,4 +1,3 @@
FROM alpine:3.5
RUN apk add --no-cache bash
COPY ping /
CMD ["/ping"]
CMD ["sh", "ping"]

View File

@ -1,18 +1,15 @@
# docker-ping
## ENV
- `HOSTNAME` Server you would like to continuously ping
- `TIMEOUT` Number of seconds between timeouts
- `HOSTNAME` Server you would like to continuously ping [ default=localhost ]
- `TIMEOUT` Number of seconds between timeouts [ default=300 ]
## docker-compose.yml
```yml
version: "2"
...
services:
ping:
image: willfarrell/ping
restart: always
environment:
HOSTNAME: "10.0.0.61"
TIMEOUT: 300

6
ping
View File

@ -1,4 +1,4 @@
#!/bin/bash
echo ping $HOSTNAME every $TIMEOUT sec
#!/bin/sh
echo ping ${HOSTNAME:=localhost} every ${TIMEOUT:=300} sec
while true; do ping -c 1 $HOSTNAME; sleep $TIMEOUT; done;
while true; do ping -c 1 ${HOSTNAME}; sleep ${TIMEOUT}; done;