add default & remove bash
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
FROM alpine:3.5
|
FROM alpine:3.5
|
||||||
RUN apk add --no-cache bash
|
|
||||||
COPY ping /
|
COPY ping /
|
||||||
CMD ["/ping"]
|
CMD ["sh", "ping"]
|
@ -1,18 +1,15 @@
|
|||||||
# docker-ping
|
# docker-ping
|
||||||
|
|
||||||
## ENV
|
## ENV
|
||||||
- `HOSTNAME` Server you would like to continuously ping
|
- `HOSTNAME` Server you would like to continuously ping [ default=localhost ]
|
||||||
- `TIMEOUT` Number of seconds between timeouts
|
- `TIMEOUT` Number of seconds between timeouts [ default=300 ]
|
||||||
|
|
||||||
## docker-compose.yml
|
## docker-compose.yml
|
||||||
```yml
|
```yml
|
||||||
version: "2"
|
...
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
ping:
|
ping:
|
||||||
image: willfarrell/ping
|
image: willfarrell/ping
|
||||||
restart: always
|
|
||||||
environment:
|
environment:
|
||||||
HOSTNAME: "10.0.0.61"
|
HOSTNAME: "10.0.0.61"
|
||||||
TIMEOUT: 300
|
TIMEOUT: 300
|
||||||
|
6
ping
6
ping
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
echo ping $HOSTNAME every $TIMEOUT sec
|
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;
|
Reference in New Issue
Block a user